更多“下面程序运行后的输出结果为() class A{ static int y=6; void showy(){ System.out.println("y="+y); } } class testA{ …”相关的问题
第1题
下面程序运行后的输出结果为() class A{ static int y=6; void showy(){ System.out.println("y="+y); } } class testA{ public static void main(String aaa []){ A a1 = new A(); A.y+=1; a1.y++; a1.showy(); } } 输出结果选择:
点击查看答案
第2题
下面程序运行后的输出结果为() class A{ public int y=6; void showy(){ System.out.println("y="+y); } } class testA{ public static void main(String aaa []){ A a1 = new A(); A b1 = new A(); a1.y++; b1.showy(); } } 输出结果选择:
点击查看答案
第3题
以下内容在同一个源程序中: class A { int a; A(int a) { this.a=a; } int add() { return a+10; } } class TestA { public static void f(A t) { System.out.println(t.add()); } public static void main(String[] args) { f(new A() { int add() { return a+20; } } ); } } 则()。
A.程序的运行结果为输出0
B.程序的运行结果为输出10
C.程序的运行结果为输出20
D.程序不能编译通过
点击查看答案
第4题
编译运行以下程序后,关于输出结果的说明正确的是()。 public class Conditional{ public static void main(String args[ ]){ int x=4; System.out.println(“value is “+ ((x>4) ? 99.9:9)); } }
A.输出结果为:value is 99.9
B.输出结果为:value is 9
C.输出结果为:value is 9.0
D.编译错误
点击查看答案
第5题
【单选题】下面程序段的执行结果是什么? public class Foo{ public static void main(String[] args){ try{ return;} finally{System.out.println("Finally"); } } }
A.编译能通过,但运行时会出现一个例外。
B.程序正常运行,并输出 "Finally"。
C.程序正常运行,但不输出任何结果。
D.因为没有catch语句块,所以不能通过编译。
点击查看答案
第6题
【填空题】写出下面程序执行后的运行结果: #include<iostream> using namespace std; int main____ { char a[30],b[30]; int k; gets____; gets____; k=strcmp____; if____ puts____; else if____ puts____; return 0; } 输入love China 输出结果是什么?
点击查看答案
第7题
有以下程序段: m=5 sum=0 while m<10: sum=sum+m m=m+1 print(sum) 程序运行后输出的结果为: ()
点击查看答案
第8题
运行以下程序,输出结果为: lst=[1,2,3,4,5] for i in lst: i*=2 print(lst[3])
点击查看答案
第9题
运行以下程序,输出结果为: lst1=[1,2,3,4,5] lst2=[ i>3 for i in lst1] print(lst2[2])
点击查看答案