publicclassClassA{publicintgetValue(){intvalue=0;booleansetting=true;Stringtitle=”Hello”;(value||(setting&&title==Hello”)){return1;}(value==1&title.equals(”Hello”)){return2;}}}And:ClassAa=newClassA();a.getValue();Whatistheresult?()
A.1
B.2
C.Compilationfails.
D.Thecoderunswithnooutput.
E.Anexceptionisthrownatruntime.
第1题:
下列程序段的输出是( )。 public class Test { public static void main (String args[ ]) { String ss1 = new String("hello"); String ss2 = new String("hello"); System.out.println(ssl == ss2); System.out.println (ssequals(ss2)); } }
A.true, false
B.true, true
C.false, true
D.false, false
第2题:
已知字符串s='hello',则表达式'he' not in 'hello'的值为:
A.'True'
B.'False'
C.True
D.False
第3题:
为了向文件hello.txt尾部追加数据,下列哪个是正确创建指向hello.txt的流()
A.try{ OutputStream out=new FileOutputStream("hello.txt"); }catch(IOException e) { }
B.try{ OutputStream out=new FileOutputStream("hello.txt",true); }catch(IOException e) { }
C.try{ OutputStream out=new FileOutputStream("hello.txt",false); }catch(IOException e) { }
D.try{ OutputStream out=new OutputStream("hello.txt",true); }catch(IOException e) { }
第4题:
3、已知字符串s='hello',则表达式'he' not in 'hello'的值为:
A.'True'
B.'False'
C.True
D.False
第5题:
以下变量初始化语句中,正确的有 ()
A.boolean flag = true;
B.int i = 32;
C.float r = 10.0;
D.double pi = 3.1415926;
E.int value = 32.0;