Skip to content

Instantly share code, notes, and snippets.

@naxmefy
Created March 25, 2014 09:20
Show Gist options
  • Save naxmefy/9757962 to your computer and use it in GitHub Desktop.
Save naxmefy/9757962 to your computer and use it in GitHub Desktop.
vererbung ohne konstruktor??
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;
}
}
public class Parent
{
private String name;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
}
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