《网络程序设计》一.选择题[ 1 ] 假设有如下代码:1
public class Colors { 2
public static void main(String args[]) { 3
int n = 1; 4
System
println("The Color is " + args[n]); 5
} 设程序已经通过编译并生成文件Colors
class,运行以下哪一条命令会产生输出"The Color is blue"
Colors red green blue yellow B
java Colors blue green red yellow C
java Colors green blue red yellow D
java Colors
class blue green red yellow E
java Colors
class green blue red yellow 答: C [ 2 ] 当编译和运行下列代码时会产生什么情况
public class StrEq { 2
private StrEq() { 3
String s = "Bob"; 4
String s2 = new String("Bob"); 5
if (s == s2){ 6
System
println("Equal"); 7
else{ 9
System
println("Not equal"); 10
public static void main(String args[]){ 13
StrEq s = new StrEq(); 14
程序能通过编译并输出"Equal"
程序能通过编译并输出"Not Equal"