Sunday, February 20, 2011
Example of interface in java
Objective type questions on interface in java and answers
(1)
interface Apple{
float cost=9.5f;
public void display();
}
class Try implements Apple{
public static void main(String[] args){
Try t=new Try();
t.display();
}
public void display(){
System.out.print("cost of apple is :"+cost);
}
}
What will output when
Labels:
Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment