Java程序员认证模拟题及详细分析(1) 26. Give following class: class AClass{ private long val. public AClass(long v){val=v.} public static void main(String args[]){ AClass x=new AClass(10L). AClass y=new AClass(10L). AClass z=y. long a=10L. int b=10. } } Which expression result is true? A. a==b. B. a==x. C. y==z. D. x==y. E. a==10.0.
27. A socket object has been created and connected to a standard internet service on a remote network server. Which construction give the most suitable means for reading ASCII data online at a time from the socket? A. InputStream in=s.getInputStream(). B. DataInputStream in=new DataInputstream(s.getInputStream()). C. ByteArrayInputStream in=new ByteArrayInputStream(s.getInputStream()). D. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream())). E. BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()),”8859-1”).
28. String s=”Example String”. Which operation is legal? A. s>>>=3. B. int i=s.length(). C. s[3]=”x”. D. String short_s=s.trim(). E. String t=”root” s.
29. What happens when you try to compile and run the following program? class Mystery{ String s. public static void main(String[] args){ Mystery m=new Mystery(). m.go(). } void Mystery(){ s=”constructor”. } void go(){ System.out.println(s). } } A. this code will not compile B. this code compliles but throws an exception at runtime C. this code runs but nothing appears in the standard output D. this code runs and “constructor” in the standard output E. this code runs and writes ”null” in the standard output