class ex
{
int i = 1;
}
interface ie
{
int i = 3;
}
public class TestExtends extends ex implements ie
{
int i = 2; //如果注释此行 则1处给编译错误:The field te.i is ambiguous
public static void main(String[] args)
{
TestExtends te = new TestExtends();
System.out.println(te.i);//1
}
}
{
int i = 1;
}
interface ie
{
int i = 3;
}
public class TestExtends extends ex implements ie
{
int i = 2; //如果注释此行 则1处给编译错误:The field te.i is ambiguous
public static void main(String[] args)
{
TestExtends te = new TestExtends();
System.out.println(te.i);//1
}
}