网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
1. public class returnIt ( 2. returnType methodA(byte x, double y) ( 3. return (short) x/y * 2; 4. ) 5. ) What is the valid returnType for methodA in line 2?()
A
Int
B
Byte
C
Long
D
Short
E
Float
F
Double
参考答案
参考解析
解析:
暂无解析
更多 “单选题1. public class returnIt ( 2. returnType methodA(byte x, double y) ( 3. return (short) x/y * 2; 4. ) 5. ) What is the valid returnType for methodA in line 2?()A IntB ByteC LongD ShortE FloatF Double” 相关考题
考题
多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used to implement sorting allows this class to define only one sort sequence.DThe interface used to implement sorting allows this class to define many different sort sequences.
考题
多选题switch(x) { default: System.out.println(“Hello”); } Which two are acceptable types for x?()AbyteBlongCcharDfloatEShortFLong
考题
单选题public class X implements Runnable ( private int x; private int y; public static void main(String [] args) ( X that = new X(); (new Thread(that)) . start( ); (new Thread(that)) . start( ); ) public synchronized void run( ) ( for (;;) ( x++; y++; System.out.printIn(“x = “ + x + “, y = “ + y); ) ) ) What is the result?()A
An error at line 11 causes compilation to fail.B
Errors at lines 7 and 8 cause compilation to fail.C
The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”)D
The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”)E
The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=2s, y=2”)
考题
多选题Which two interfaces provide the capability to store objects using a key-value pair?()AJava.util.Map.BJava.util.Set.CJava.util.List.DJava.util.StoredSet.EJava.util.StoredMap.FJava.util.Collection.
考题
单选题public class Foo { public int a; public Foo() { a = 3; } public void addFive() { a += 5; } } and: public class Bar extends Foo { public int a; public Bar() { a = 8; } public void addFive() { this.a +=5; } } invoked with: Foo foo = new Bar(); foo.addFive(); System.out.println(”Value: “+ foo.a); What is the result?()A
Value: 3B
Value: 8C
Value: 13D
Compilation fails.E
The code runs with no output.F
An exception is thrown at runtime.
考题
单选题What is wrong with the following code?() class MyException extends Exception {} public class Qb4ab { public void foo() { try { bar(); } finally { baz(); } catch (MyException e) {} } public void bar() throws MyException { throw new MyException(); } public void baz() throws RuntimeException { throw new RuntimeException(); } }A
Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.B
A try block cannot be followed by both a catch and a finally block.C
An empty catch block is not allowed.D
A catch block cannot follow a finally block.E
A finally block must always follow one or more catch blocks.
热门标签
最新试卷