Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
public class JavaApplication1 {
/**
*/
// Interface just contains the definations that needs to be implemented whoever
// conforms to the Animal interface - It's like a basketball coach who doesn't know
// how to play but can teach other about it.
public interface Animal{
public String eat();
public void run();
public void jump();
}
public class ZooAnimals implements Animal{
public String eat;
public String run;
public String jump;
// This is a constructure method.
public ZooAnimals(String eat, String run, String jump){
this.eat = eat;
this.jump = jump;
this.run = run;
}
@Override
public String eat() {
return this.eat;
}
@Override
public void run() {
System.out.println(this.run);
}
@Override
public void jump() {
System.out.println(this.jump);
}
}
public void animalInformation(){
ZooAnimals x;
x = new ZooAnimals("Eat fresh", "Can run fast", "Cannot jump high");
String result = x.eat();
System.out.println(result);
}
public static void main(String[] args) {
// TODO code application logic here
JavaApplication1 j1 = new JavaApplication1();
j1.animalInformation();
}
}