62,636
社区成员




class Test
{
private int f()
{
return 0;
}
public static void main(String[] args)
{
Test t = new Test();
t.f();
}
}
class Test
{
private int f()
{
return 0;
}
public static void main(String[] args)
{
Test t = new Test();
t.f();
}
}
public class Test
{
private int f()
{
System.out.println("I am f()!");
return 0;
}
}
class Other
{
public static void main(String[] args)
{
Test t = new Test();
t.f();
}
}
class Test
{
private a = 0;
void f()
{
System.out.println(a);//对象没有形成,我们正在建设类
}
}
class Test
{
private int f()
{
return 0;
}
public static void main(String[] args)
{
Test t = new Test();//在建设类的时候,定义了该实例对象,却因为在类的定义中,可以访问private成员
t.f();
}
}
class Other
{
public static void main(String[] args)
{
Test t = new Test();//不再Test类的定义中,不能访问private
t.f();
}
}
class Other
{
public static void main(String[] args)
{
Test t = new Test();
t.f();
}
}