Questions
Overriding and Overloading is for ?
- Methods and variables
- class
- variables
- Methods
Overriding and Overloading is for ?
- Methods and variables
- class
- variables
- Methods
Which one of these lists contains only Java programming language keywords?
- class, if, void, long, Int, continue
- goto, instanceof, native, finally, default, throws
- try, virtual, throw, final, volatile, transient
- strictfp, constant, super, implements, do
Which one of these lists contains only Java programming language keywords?
- class, if, void, long, Int, continue
- goto, instanceof, native, finally, default, throws
- try, virtual, throw, final, volatile, transient
- strictfp, constant, super, implements, do
Which will legally declare, construct, and initialize an array?
- int [] myList = {"1", "2", "3"};
- int [] myList = (5, 8, 2);
- int myList [] [] = {4,9,7,0};
- int myList [] = {4, 3, 7};
Which will legally declare, construct, and initialize an array?
- int [] myList = {"1", "2", "3"};
- int [] myList = (5, 8, 2);
- int myList [] [] = {4,9,7,0};
- int myList [] = {4, 3, 7};
Which is a reserved word in the Java programming language?
- method
- native
- subclasses
- reference
Which is a reserved word in the Java programming language?
- method
- native
- subclasses
- reference
Which is a valid keyword in java?
- interface
- string
- Float
- unsigned
Which is a valid keyword in java?
- interface
- string
- Float
- unsigned
Which one of the following will declare an array and initialize it with five numbers?
- Array a = new Array(5);
- int [] a = {23,22,21,20,19};
- int a [] = new int[5];
- int [5] array;
Which one of the following will declare an array and initialize it with five numbers?
- Array a = new Array(5);
- int [] a = {23,22,21,20,19};
- int a [] = new int[5];
- int [5] array;
Which is the valid declarations within an interface definition?
- public double methoda();
- public final double methoda();
- static void methoda(double d1);
- protected void methoda(double d1);
Which is the valid declarations within an interface definition?
- public double methoda();
- public final double methoda();
- static void methoda(double d1);
- protected void methoda(double d1);
Which one is a valid declaration of a boolean?
- boolean b1 = 0;
- boolean b2 = 'false';
- boolean b3 = false;
- boolean b4 = Boolean.false();
Which one is a valid declaration of a boolean?
- boolean b1 = 0;
- boolean b2 = 'false';
- boolean b3 = false;
- boolean b4 = Boolean.false();
Which one is a valid declaration of a boolean?
- boolean b1 = 0;
- boolean b2 = 'false';
- boolean b3 = false;
- boolean b4 = Boolean.false();
Which is a valid declarations of a String?
- String s1 = null;
- String s2 = 'null';
- String s3 = (String) 'abc';
- String s4 = (String) '\ufeed';
Which is a valid declarations of a String?
- String s1 = null;
- String s2 = 'null';
- String s3 = (String) 'abc';
- String s4 = (String) '\ufeed';
Which is a valid declarations of a String?
- String s1 = null;
- String s2 = 'null';
- String s3 = (String) 'abc';
- String s4 = (String) '\ufeed';
Which is a valid declarations of a String?
- String s1 = null;
- String s2 = 'null';
- String s3 = (String) 'abc';
- String s4 = (String) '\ufeed';
Which is a valid declarations of a String?
- String s1 = null;
- String s2 = 'null';
- String s3 = (String) 'abc';
- String s4 = (String) '\ufeed';
What is the numerical range of a char?
- -128 to 127
- -(215) to (215) - 1
- 0 to 32767
- 0 to 65535
What is the numerical range of a char?
- -128 to 127
- -(215) to (215) - 1
- 0 to 32767
- 0 to 65535
What is the numerical range of a char?
- -128 to 127
- -(215) to (215) - 1
- 0 to 32767
- 0 to 65535
What is the numerical range of a char?
- -128 to 127
- -(215) to (215) - 1
- 0 to 32767
- 0 to 65535
You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
- public
- protected
- private
- transient
You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
- public
- protected
- private
- transient
What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?
- public
- abstract
- protected
- synchronized
- default access
Which cause a compiler error?
- int[ ] scores = {3, 5, 7};
- int [ ][ ] scores = {2,7,6}, {9,3,45};
- String cats[ ] = {"Fluffy", "Spot", "Zeus"};
- boolean results[ ] = new boolean [] {true, false, true};
You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
- public
- private
- protected
- default access
Which one creates an instance of an array?
- int[ ] ia = new int[15];
- float fa = new float[20];
- char[ ] ca = "Some String";
- int ia[ ] [ ] = { 4, 5, 6 }, { 1,2,3 };
Which of the following class level (nonlocal) variable declarations will not compile?
- protected int a;
- transient int b = 3;
- private synchronized int e;
- volatile int d;
Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?
- final
- static
- private
- protected
Which is a valid declaration within an interface?
- public static short stop = 23;
- protected short stop = 23;
- transient short stop = 23;
- final void madness(short stop);
Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?
- TreeMap
- HashMap
- LinkedHashMap
- The answer depends on the implementation of the existing instance.
Which class does not override the equals() and hashCode() methods, inheriting them directly from class Object?
- java.lang.String
- java.lang.Double
- java.lang.StringBuffer
- java.lang.Character