当前位置:首页 > 中级Java开发工程师 > 正文内容

在Java中,运行下面的代码结果是 public class Foo implements Runnable {

在Java中,运行下面的代码结果是 public class Foo implements Runnable { public void run (Thread t) { System.out.println("Running."); } public static void main (String[] args) { new Thread(new Foo()).start(); } }

A.运行时抛出一个异常

B.程序能够运行,但是没有任何输出

C.没有实现 Runnable 接口中的方法导致编译错误

D.程序运行后输出“Running”

正确答案是C

扫描二维码免费使用微信小程序搜题/刷题/查看解析。

版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。

本文链接:https://20230611.cn/post/3203082.html