0

If we create new class which has a instance variable int a, without access modified, then what will the access level of int x be

class A{ private int x = 2; // what if only declare int x= 2? } public class Program { public static void main(String[] args) { A a = new A(); System.out.println(a.x); a.x = 3; System.out.println(a.x); } }

28th Sep 2022, 11:50 AM
Oliver Pasaribu
Oliver Pasaribu - avatar
1 Respuesta
+ 1
28th Sep 2022, 12:11 PM
Bob_Li
Bob_Li - avatar