Foo has the value of 0.
Foo has the value of null.
Foo has the value of true.
Foo has the value of false.
An exception is thrown.
The code will not compile.
第1题:
boolean a=false; boolean b=true; boolean c=(a&&b)&&(!b); boolean result=(a&b)&(!b); 执行完后,正确的结果是( )。
A.c=false;result=false
B.c=true,result=true
C.c=true;result=false
D.c=false;result=true
第2题:
下列布尔变量定义中,正确并且规范的是
A.BOOLEAN canceled=false;
B.boolean canceled=false;
C.boolean CANCELED=false;
D.boolean canceled=FALSE;
第3题:
下列代码的编译或执行结果是( )。 public class Myval{ public static void main(string args[]){ MyVal m=new MyVal; aMethod; } public void aMethod{ boolean b[]=new Boolean[5]; System.OUt.println(b[0]); } }
A.1
B.null
C.0
D.编译错误
第4题:
在匹配器(Matcher)类中,用于输入字符串与模式串比较的方法是
A.static boolean matches()
B.boolean matcher,find()
C.int matcher,start()
D.int matcher,end()
第5题:
执行下列程序段之后,变量b的值为______。 public class Test9 { public static void main(String[] args) { int i=12; int j=24; boolean b1=true; boolean b=(j%i== 0)&&(!b1) ||(j/i!=2); System.out.println(b); } }
A.true
B.假
C.1
D.0
第6题:
public class Test { public static void main(String [] args) { int x =5; boolean b1 = true; boolean b2 = false; if((x==4) && !b2) System.out.print(”l “); System.out.print(”2 “); if ((b2 = true) && b1) System.out.print(”3 “); } } What is the result?()
第7题:
将有三个boolean值的数组初始化为true的是()
第8题:
int index = 1; boolean test = new Boolean; boolean foo= test [index]; What is the result?()
第9题:
public class Key { private long id1; private long 1d2; // class Key methods } A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()
第10题:
Foo has the value of 0.
Foo has the value of null.
Foo has the value of true.
Foo has the value of false.
An exception is thrown.
The code will not compile.
第11题:
2
3
1 2
2 3
1 2 3
Compilation fails.
Au exceptional is thrown at runtime.
第12题:
public void setEnabled( boolean enabled) public boolean getEnabled()
public void setEnabled( boolean enabled) public void isEnabled()
public void setEnabled( boolean enabled) public boolean isEnabled()
public boolean setEnabled( boolean enabled) public boolean getEnabled()
第13题:
阅读下面程序 public class My Val{ public static void main(String args[]){ My Val m=new My Val(); m. amethod(); } public void amethod(){ boolean b[]=new Boolean[5]; } } 程序编译或运行结果是
A.1
B.null
C.
D.编译不能过
第14题:
在匹配器(Matcher)类中,用于寻找下一个模式匹配串的方法是( )。
A.static boolean matches
B.boolean matcher.find
C.int matcher.start
D.int matcher.end
第15题:
下列关于boolean类型的叙述中,正确的是( )。
A.可以将boolean类型的数值转换为int类型的数值
B.可以将boolean类型的数值转换为字符串
C.可以将boolean类型的数值转换为char类型的数值
D.不能将boolean类型的数值转换为其他基本数据类型
第16题:
当执行下面代码时,会输出( )。 Boolean b1 = new Boolean(true); Boolean b2 = new Boolean(true); if (b1 == b2) if (bi.equals(b2)) System. out.printin ("a"); else System. out. println ("b"); else if (bi.equals(b2)) System. out.println ("c"); else System. out.printIn("d");
A.a
B.b
C.c
D.d
第17题:
下面哪些语句是没有编译错误的()
第18题:
int i,j; boolean booleanValue=(i==j)。
第19题:
Which determines if “prefs” is a directory and exists on the file system?()
第20题:
Given: 8.int index = 1: 9.Boolean [] test = new boolcan [3]; 10.boolcan foo = test [index]; What is the result()?
第21题:
int index = 1; boolean[] test = new Boolean[3]; boolean foo= test [index]; What is the result?()
第22题:
Foo has the value of 0.
Foo has the value of null.
Foo has the value of true.
Foo has the value of false.
An exception is thrown.
The code will not compile.
第23题:
Boolean exists=Directory.exists (“prefs”);
Boolean exists=(new File(“prefs”)).isDir();
Boolean exists=(new Directory(“prefs”)).exists();
Boolean exists=(new File(“prefs”)).isDirectory();
Boolean exists=true; Try{ Directory d = new Directory(“prefs”); } catch (FileNotFoundException e) { exists = false; }
第24题:
foo has the value of 0.
foo has the value of null.
foo has the value of true.
foo has the value of false.
An-exception is thrown.
The code will not compile.