Hot Posts

Abstract class and Constructor


What is the effect on a child class of writing a constructor in an abstract parent class?


The answer is…..


public abstract class Animal {

	String name;

	public Animal(String name) { = name;

	abstract boolean born();
	abstract boolean die();

	public void setColour(){}


public class Horse extends Animal{

	String name;
	String colour;

	public Horse(String name, String colour){
		super(name); = name;
		this.colour = colour;

	public Horse(String name) {
		this(name, "red");

	boolean born() {
		return false;

	boolean die() {
		return false;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: