Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
341 B
1
Indexable
Never
class animal{
	int leg=5;
	animal(int a){
		legs=a;
	}
	void display(){
		System.out.println("Number of legs: "+legs);
	}
}

class dog extends animal{
	int legs=4;
	dog(int a){
		super(a);
		legs=a;
	}
	void display(){
		System.out.println("Number of legs: "+legs);
		System.out.println("Number of legs of general animal: "+super.legs);
	}
}