//PROGRAM 6-16 class TingkatAkses { int a; public int b; private int c; public void setC(int nilai) { c = nilai; } public int getC() { return c; } } class DemoPublicDanPrivate { public static void main(String[] args) { TingkatAkses obj = new TingkatAkses(); obj.a = 10; // BENAR, karena a secara default bersifat public obj.b = 20; // BENAR, karena b bersifat public //obj.c = 30; // SALAH, karena c bersifat private obj.setC(30); // BENAR, karena method setC() bersifat public System.out.println("Nilai obj.a : " + obj.a); System.out.println("Nilai obj.b : " + obj.b); System.out.println("Nilai obj.c : " + obj.getC()); } }