Rabu, 21 Oktober 2009

Superclass Java

== Japan.java ==

public class Japan {

private String decora;
private String cyber;
private String gothic;


public Japan (String decora, String cyber, String gothic)
{
this.decora = decora;
this.cyber = cyber;
this.gothic = gothic;

}
public void info()
{
System.out.println("Full of accessories disebut : " + this.decora);
System.out.println("Colouful hair disebut : " + this.cyber);
System.out.println("Dark Fashion disebut : " + this.gothic);

}
}


--------------------------------------------------------------------------------------------


== Harajuku.java ==

public class Harajuku extends Japan
{
private static int JmlFashion = 3 ;
public Harajuku (String harajuku, String cyber, String gothic, int JmlFashion)
{
super (harajuku, cyber, gothic);
JmlFashion++;
}
public void info()
{
System.out.println("Fashion Style yang terkenal dijepang : " + JmlFashion);
super.info();
}
}


---------------------------------------------------------------------------------------------


== HarajukuTest.java ==

public class HarajukuTest
{

public static void main(String[] args)
{
Harajuku obj1 = new Harajuku ("harajuku","cyber","gothic",2);
obj1.info();
}
}


Output :

0 komentar:

Posting Komentar