Rabu, 21 Oktober 2009
di
06.08
|
Charlie.java
public class Charlie {
private int a = 5;
protected int b = 7;
public void info()
{
System.out.println("Dipanggil pada = " + this.getClass().getName());
System.out.println("a = " + a);
System.out.println("b = " + b);
}
}
Delta.java
public class Delta extends Charlie
{
private int c = 9;
public void info()
{
System.out.println("Dipanggil pada = " + this.getClass().getName());
System.out.println("b = "+b);
System.out.println("c = "+c);
}
}
Echo.java
public class Echo {
public static void main(String[] args) {
Charlie obj1 = new Charlie();
obj1.info();
Delta obj2 = new Delta();
System.out.println("");
obj2.info();
}
}
Diposting oleh
UntarA pRatama
0 komentar:
Posting Komentar