" స్టాటిక్ మెథడ్స్‌తో పాటు, స్టాటిక్ క్లాస్‌లు కూడా ఉన్నాయి. వీటిని మేము తర్వాత మరింత వివరంగా చర్చిస్తాము. ప్రస్తుతానికి, నేను మీకు ఒక ఉదాహరణ చూపిస్తాను:"

ఉదాహరణ:
public class StaticClassExample
{
    private static int catCount = 0;

    public static void main(String[] args) throws Exception
    {
        Cat bella = new Cat("Bella");
        Cat tiger = new Cat("Tiger");

        System.out.println("Cat count " + catCount);
    }

     public static class Cat
    {
        private String name;

        public Cat(String name)
         {
            this.name = name;
            StaticClassExample.catCount++;
         }
     }

}
2
టాస్క్
Java Syntax,  స్థాయిపాఠం
లాక్ చేయబడింది
Code entry
Your attention, please! Now recruiting code entry personnel for CodeGym. So turn up your focus, let your fingers relax, read the code, and then... type it into the appropriate box. Code entry is far from a useless exercise, though it might seem so at first glance: it allows a beginner to get used to and remember syntax (modern IDEs seldom make this possible).

" మీకు కావలసినన్ని క్యాట్ ఆబ్జెక్ట్‌లను మీరు సృష్టించవచ్చు. కానీ స్టాటిక్ వేరియబుల్ విషయంలో ఇది అలా కాదు. స్టాటిక్ వేరియబుల్ యొక్క ఒక కాపీ మాత్రమే ఉంది."

"క్లాస్ డిక్లరేషన్‌లో స్టాటిక్ మాడిఫైయర్‌ని ఉపయోగించడం యొక్క ముఖ్య ఉద్దేశ్యం క్యాట్ మరియు స్టాటిక్‌క్లాస్ ఎగ్జాంపుల్ క్లాస్‌ల మధ్య సంబంధాన్ని నియంత్రించడం . దీని ఆలోచన సుమారుగా ఉంది: క్యాట్ క్లాస్ స్టాటిక్ క్లాస్ ఎక్సాంపుల్ ఆబ్జెక్ట్‌లకు లింక్ చేయబడదు మరియు ఉదాహరణను యాక్సెస్ చేయదు (కాని స్టాటిక్) StaticClassExample క్లాస్ యొక్క వేరియబుల్స్."

"కాబట్టి నేను తరగతుల లోపల తరగతులను సృష్టించగలనా?"

"అవును. జావా దానిని అనుమతిస్తుంది, కానీ ఇప్పుడే దాని గురించి పెద్దగా ఆలోచించవద్దు. భవిష్యత్తులో నేను మీకు మరికొన్ని విషయాలు వివరించినప్పుడు అది మరింత స్పష్టమవుతుంది."

"నేను ఆశిస్తున్నాను, రిషీ."