一段JAVA小程序

258关注449浏览

Given:
2. public class Foo implements Runnable (
3. public void run (Thread t) {
4. system.out.printIn("Running.");
5. }
6. public static void main (String[] args) {
7. new thread (new Foo()).start();
8. )

展开全部
收起
4回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 吴静怡

    20人对此回答表示赞同

    在程序里 类型 Foo 必须实现继承的抽象方法 Runnable.run()
    所以你需要把程序该为:
    public class Foo implements Runnable {
    public void run (Thread t) {
    System.out.println("Running.");
    }
    public static void main (String[] args) {
    new Thread (
    展开
    20
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Eliana4

    15人对此回答表示赞同

    楼上正解
    run方法是要重写的
    eclipse工具里会报错的
    展开
    15
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Ryan

    7人对此回答表示赞同

    Runnable 接口中的 run() 没有参数,需要实现一个 void run() 的方法。
    展开
    7
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Abigail

    3人对此回答表示赞同

    public class Foo implements Runnable ( 这里不是括号 应该是 大括号 {
    展开
    3
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部