+ 1
I need an explanation for 3,4,5 th rows. Whether it's a method or something. Can anyone please explain me clearly
public class Counter { public static int COUNT=0; Counter() { COUNT++; } } public class MyClass { public static void main(String[ ] args) { Counter c1 = new Counter(); Counter c2 = new Counter(); System.out.println(Counter.COUNT); } }
1 Resposta
0
Counter (){
COUNT++
}
Is it a method? or Class