Created
March 25, 2014 09:20
-
-
Save naxmefy/9757962 to your computer and use it in GitHub Desktop.
vererbung ohne konstruktor??
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirstChild extends Parent | |
{ | |
private String color; | |
public FirstChild(String color) | |
{ | |
this.color = color; | |
} | |
public String getColor() | |
{ | |
return color; | |
} | |
public void setColor(String color) | |
{ | |
this.color = color; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Parent | |
{ | |
private String name; | |
public String getName() | |
{ | |
return name; | |
} | |
public void setName(String name) | |
{ | |
this.name = name; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PeopleCheck | |
{ | |
public static void main(String[] args) | |
{ | |
FirstChild firstChild = new FirstChild("Blue"); | |
firstChild.setName("Nami"); | |
System.out.println(firstChild.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment