41.interface1
interface inf1
{
void print();
int no = 123;
}
class child implements inf1
{
public void print()
{
System.out.println("print method of interface inf1");
}
}
class intf1
{
public static void main(String[] args) {
child obj = new child();
obj.print();
System.out.println("Number : " + obj.no);
System.out.println("Number : " + inf1.no);
System.out.println("Number : " + child.no);
}
}
OUTPUT:
Number : 123
Number : 123
Number : 123
Comments
Post a Comment