" Saliyane metode statis, ana kelas statis. Kita bakal ngrembug babagan iki kanthi luwih rinci mengko. Saiki, aku mung nuduhake conto:"

Tuladha:
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
tugas
Java Syntax,  tingkatwulangan
Dikunci
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).

" Sampeyan bisa nggawe akeh obyek Cat sing dikarepake. Nanging iki ora kaya variabel statis. Mung siji salinan variabel statis sing ana."

"Tujuan utama nggunakake modifier statis ing deklarasi kelas yaiku kanggo ngontrol hubungan antarane kelas Cat lan StaticClassExample . Ide iki kira-kira: kelas Cat ora disambung karo obyek StaticClassExample lan ora bisa ngakses instance (non- statis) saka kelas StaticClassExample."

"Dadi aku bisa nggawe kelas ing njero kelas?"

"Iya, Jawa ngidini, nanging aja mikir banget saiki. Iku bakal dadi luwih cetha yen aku nerangake sawetara bab liyane kanggo sampeyan ing mangsa ngarep."

“Muga-muga ngono, Rishi.”