第2提是说:描述体现封装性的选项:D:成员函数设为private,当然是对的啦
E:是说通过别的方法来实现访问(我们通常不是通过getXXX和setXXX()来实现给外部的吗)4.选B对了,因为Foo类没有实现Runnable中的run()方法
改为以下的就可以啦import java.lang.Thread;
public class Foo implements Runnable
{
public void run()
{
System.out.println("Running");
}
public static void main(String[] args)
{
Foo ff=new Foo();
Thread t =new Thread(ff);
t.start();
}
}呵呵瞎说的不知道对了没有呢!!
E:是说通过别的方法来实现访问(我们通常不是通过getXXX和setXXX()来实现给外部的吗)4.选B对了,因为Foo类没有实现Runnable中的run()方法
改为以下的就可以啦import java.lang.Thread;
public class Foo implements Runnable
{
public void run()
{
System.out.println("Running");
}
public static void main(String[] args)
{
Foo ff=new Foo();
Thread t =new Thread(ff);
t.start();
}
}呵呵瞎说的不知道对了没有呢!!
(2) public void run(Thread t) {
System.out.println("Running");
}
public static void main(String[] args) {
new Foo().start();
}
}
A.An error at line 1 causes complication to fail
B.An error at line 2 causes complication to fail
答案:B
疑问:我认为答案错了,应该选A
楼主错 了,她是先从main开始执行的