0
What output results from this code?
class Person { public static int pCount; public static void main(String[ ] args) { Person.pCount = 1; Person.pCount++; System.out.println(Person.pCount); } } ------------------------ The output is 2, but i don't understand why and how!!!
5 Respuestas
+ 3
2
+ 1
pCount is a static variable .
and in line one is 1 and next line with ++ increase 2
+ 1
2
0
2
- 2
Person.pCount++ makes the variable increased by 1.