看看Test1和Test2性能有什么差别吗public interface In
{
void method1();
}
public class InIm implements In
{
public void method1()
{
System.out.println("------------------------");
}
}
public class Test1
{
public static void main(String[] args)
{
In user1 = new InIm();
user1.method1();
}
}
public class Test2
{
public static void main(String[] args)
{
In user1 = new InIm();
user1.method1();
}
}
{
void method1();
}
public class InIm implements In
{
public void method1()
{
System.out.println("------------------------");
}
}
public class Test1
{
public static void main(String[] args)
{
In user1 = new InIm();
user1.method1();
}
}
public class Test2
{
public static void main(String[] args)
{
In user1 = new InIm();
user1.method1();
}
}
{
public static void main(String[] args)
{
InIm user1 = new InIm();
user1.method1();
}
}
能那么多public 吗
main也两个 是不是代码分开看啊
interface In
{
void method1();
}
class InIm implements In
{
public void method1()
{
System.out.println("------------------------");
}
}
public class Test1
{
public static void main(String[] args)
{
In user1 = new InIm();
user1.method1();
}
}
...........................................
...........................................
public class Test2
{
public static void main(String[] args)
{
In user1 = new InIm();
user1.method1();
}
}
两个类是没区别的
InIm user1 = new InIm();这句应该会报错吧接口能new么?
上面写错了 是In user1 = new In();