A. Float foo = -1;
B. Float foo = 1.0;
C. Float foo = 42e1;
D. Float foo = 2.02f;
E. Float foo = 3.03d;
F. Float foo = 0x0123;
您可能感兴趣的试卷
你可能感兴趣的试题
A. Run
B. Import
C. Default
D. Implement
//point X
public class foo (
public static void main (Stringargs) throws Exception {
printWriter out = new PrintWriter (new )
java.io.outputStreamWriter (System.out), true;
out.printIn(“Hello”);
}
)
Which statement at PointX on line 1 allows this code to compile and run?()
A. Import java.io.PrintWriter;
B. Include java.io.PrintWriter;
C. Import java.io.OutputStreamWriter;
D. Include java.io.OutputStreamWriter;
E. No statement is needed.
interface foo {
int k = 0;
}
public class test implements Foo (
public static void main(String args) (
int i;
Test test = new test ();
i= test.k;
i= Test.k;
i= Foo.k;
)
)
What is the result? ()
A. Compilation succeeds.
B. An error at line 2 causes compilation to fail.
C. An error at line 9 causes compilation to fail.
D. An error at line 10 causes compilation to fail.
E. An error at line 11 causes compilation to fail.
public class enclosingone (
public class insideone{}
)
public class inertest(
public static void main (stringargs)(
enclosingone eo= new enclosingone ();
//insert code here
)
)
Which statement at line 7 constructs an instance of the inner class?()
A. InsideOnew ei= eo.new InsideOn();
B. Eo.InsideOne ei = eo.new InsideOne();
C. InsideOne ei = EnclosingOne.new InsideOne();
D. EnclosingOne.InsideOne ei = eo.new InsideOne();
package foo;
public class Outer (
public static class Inner (
)
)
Which statement is true?()
A. An instance of the Inner class can be constructed with “new Outer.Inner()”
B. An instance of the inner class cannot be constructed outside of package foo.
C. An instance of the inner class can only be constructed from within the outer class.
D. From within the package bar, an instance of the inner class can be constructed with “new inner()”
A. An anonymous inner class may be declared as final.
B. An anonymous inner class can be declared as private.
C. An anonymous inner class can implement multiple interfaces.
D. An anonymous inner class can access final variables in any enclosing scope.
E. Construction of an instance of a static inner class requires an instance of the enclosing outer class.
A. public interface Person{} public class Employee extends Person{}
B. public interface Shape{} public class Employee extends Shape{}
C. public interface Color{} public class Employee extends Color{}
D. public class Species{} public class Animal (private Species species;)
E. interface Component{} Class Container implements Component ( Private Component[ ] children; )
public class MethodOver {
public void setVar (int a, int b, float c) {
}
}
Which two overload the setVar method?()
A. Private void setVar (int a, float c, int b) {}
B. Protected void setVar (int a, int b, float c) {}
C. Public int setVar (int a, float c, int b) (return a;)
D. Public int setVar (int a, int b, float c) (return a;)
E. Protected float setVar (int a, int b, float c) (return c;)
public class ConstOver
{
public ConstOver (int x, int y, int z) {
}
}
Which two overload the ConstOver constructor? ()
A.ConstOver(){}
B.Protected int ConstOver (){}
C.Private ConstOver (int z, int y, byte x) {}
D.Public Object ConstOver (int x, int y, int z) {}
E. Public void ConstOver (byte x, byte y, byte z){}
public class test {
public static void add3 (Integer i){
int val = i.intValue ( );
val += 3;
i = new Integer (val);
}
public static void main (String args [ ] )
{ Integer i = new Integer (0);
add3 (i);
system.out.printIn (i.intValue ( ) );
}
}
What is the result?()
A. Compilation will fail.
B. The program prints “0”.
C. The program prints “3”.
D. Compilation will succeed but an exception will be thrown at line 3.
最新试题
What is the result?()
Which two are possible results?()
What is the result?()
Which two statements are true?()
What is the result?()
What is the result?()
What is the result?()
What is the result?()
A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
Which code, inserted at line 4, guarantees that this program will output [1, 2]?()