下列程序的输出结果是 interface Inter{ public final static int A=100; } class My implem
A.100
B.0
C.A
D.程序有错误
A.100
B.0
C.A
D.程序有错误
public void run()
{char c;for(int i=0;i<20;i++)
{c=——————————;theStack.push(c);
System.out.println("Produced:"+c);try
{Thread.sleep((int)(Math.random()*100));}
catch(InterrupedException e)
{ }}}
A、(char)(Math.random()*26+'A')
B、(Math.random()*26+'A')
C、(char)(Math.random()*26)
D、(char)(Math.random()+'A')
A、interface A { void print(){ }; }
B、abstract interface A{ print(); }
C、abatract interface A{ abstract void print(){ }; }
D、interface A{ void print(); }
阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译 失败的原因。 public class Demo { public static void main(String[] args) { Base b1=Base.getBaseInstance1(); System.out.print(b1.getS()); Base b2=Base.getBaseInstance2(); System.out.print(b2.getS()); } } abstract class Base { private static String s = "base"; public static Base getBaseInstance1() { return new Base() { public String getS() { return s; } }; } public static Base getBaseInstance2() { return new Base("good") { public String getS() { return s; } }; } public Base() { } public Base(String s) { this.s = s; } public abstract String getS(); }
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!