Hi Wentao Liang,
Even in the interface also, we can not place one more public class.
It gives error like " The public type of subclass must be in its own file ". Just check this code.
public interface InterfaceTesting {
void display();
}
public class SubClassOfInterface implements InterfaceTesting{
public void display(){
System.out.println("in display Method");
}
public static void main(
String args[]){
SubClassOfInterface subClass = new SubClassOfInterface();
subClass.display();
}
}
the above code give error..
package com;
public interface InterfaceTesting {
void display();
}
class SubClassOfInterface implements InterfaceTesting{
public void display(){
System.out.println("in display Method");
}
public static void main(String args[]){
SubClassOfInterface subClass = new SubClassOfInterface();
subClass.display();
}
}
will give output as ...
in display Method
reply me if i am mistake ....
Suneel.