下面程序段; 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
单选题int index = 1; boolean[] test = new Boolean[3]; boolean foo= test [index]; What is the result?()AFoo has the value of 0.BFoo has the value of null.CFoo has the value of true.DFoo has the value of false.EAn exception is thrown.FThe code will not compile.
点击查看答案
单选题public void foo( boolean a, boolean b ){ if( a ) { System.out.println( “A” ); } else if ( a && b ) { System.out.println( “A&&B” ); } else { 17. if ( !b ) { System.out.println( “notB” ); } else { System.out.println( “ELSE” ); } } } What is correct?()AIf a is true and b is true then the output is “A&&B”.BIf a is true and b is false then the output is “notB”.CIf a is false and b is true then the output is “ELSE”.DIf a is false and b is false then the output is “ELSE”.
单选题int index = 1; boolean test = new Boolean; boolean foo= test [index]; What is the result?()AFoo has the value of 0.BFoo has the value of null.CFoo has the value of true.DFoo has the value of false.EAn exception is thrown.FThe code will not compile.
单选题Which determines if “prefs” is a directory and exists on the file system?()ABoolean exists=Directory.exists (“prefs”);BBoolean exists=(new File(“prefs”)).isDir();CBoolean exists=(new Directory(“prefs”)).exists();DBoolean exists=(new File(“prefs”)).isDirectory();EBoolean exists=true; Try{ Directory d = new Directory(“prefs”); } catch (FileNotFoundException e) { exists = false; }
多选题A JavaBeans component has the following field: 11. private boolean enabled; Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()Apublic void setEnabled( boolean enabled) public boolean getEnabled()Bpublic void setEnabled( boolean enabled) public void isEnabled()Cpublic void setEnabled( boolean enabled) public boolean isEnabled()Dpublic boolean setEnabled( boolean enabled) public boolean getEnabled()
单选题public void testIfA(){ if(testIfB("True")){ System.out.println("True"); }else{ System.out.println("Nottrue"); } } public Boolean testIfB(Stringstr){ return Boolean.valueOf(str); } What is the result when method testIfA is invoked?()A TrueB NottrueC Anexceptionisthrownatruntime.D Compilationfailsbecauseofanerroratline12.E Compilationfailsbecauseofanerroratline19.
判断题boolean数据类型的数据只有true和false两个值。()A 对B 错