Premium

Oracle Java Programming Certification Questions and Answers (Dumps and Practice Questions)



Question : You have been given following code

class StaticField {
static int i = 7;

public static void main(String[] args) {
StaticField obj = new StaticField();
obj.i++;
StaticField.i++;
obj.i++;
System.out.println(StaticField.i + " " + obj.i);
}
}

what would be printed ?


 : You have been given following code
1. 10 10
2. 8 9
3. Access Mostly Uused Products by 50000+ Subscribers
4. 7 10



Correct Answer : Get Lastest Questions and Answer
Explanation:









Question : Which declaration initializes a boolean variable?

 : Which declaration initializes a boolean variable?
1. boolean h = 1;
2. boolean k = 0;
3. Access Mostly Uused Products by 50000+ Subscribers
4. boolean j = (1 < 5);



Correct Answer : Get Lastest Questions and Answer :

Explanation: The primitive type boolean has only two possible values: true and false. Here j is set to (1 <5), which evaluates to true







Question : Which two are Java Exception classes?
A. SercurityException
B. DuplicatePathException
C. IllegalArgumentException
D. TooManyArgumentsException

 : Which two are Java Exception classes?
1. A,B
2. B,C
3. Access Mostly Uused Products by 50000+ Subscribers
4. A,D
5. A,C



Correct Answer : Get Lastest Questions and Answer :






Related Questions


Question : You have been given two classes as shown.
What will be printed when executed.



 : You have been given two classes as shown.
1. Welcome HadooExam
Welcome HadooExam
2.
Welcome StringBuilder@(Alpha numeric HashcodeValue)
Welcome MyUtility@(Alpha numeric HashcodeValue)
3. Access Mostly Uused Products by 50000+ Subscribers
Welcome MyUtility@(Alpha numeric HashcodeValue)
4. Compilation will fail in MyApp class.


Question : You have been given code as shown image. Please select line number on which compilation fails.

A. Line 7
B. Line 8
C. Line 9
D. Line 10
E. Line 11
F. Line 12

 : You have been given code as shown image. Please select line number on which compilation fails.
1. A,B,C
2. A,D,F
3. Access Mostly Uused Products by 50000+ Subscribers
4. C,D,F



Question : You have been given below code

default void hadoopexam(){}

Which statement is true?


 : You have been given below code
1. This method is invalid.
2. This method can be used only in an interface.
3. Access Mostly Uused Products by 50000+ Subscribers
4. This method can be used only in an interface or an abstract class.
5. None of above.







Question : You have been given code as shown.

Which option represents the state of the num array
after successful completion of the outer loop?
  : You have been given code as shown.
1. num[0][0]=10
num[0][1]=10
num[0][2]=10

2. num[0][0]=10
num[1][0]=10
num[2][0]=10
3. Access Mostly Uused Products by 50000+ Subscribers
num[0][1]=0
num[0][2]=0
4. num[0][0]=10
num[1][0]=0
num[2][0]=0




Question : You have been given a class as shown.
What would be the result if it is compiled/run

  : You have been given a class as shown.
1. Jaya25
Venkat52
2. Compilation fails only at line n1
C. Compilation fails only at line n2
3. Access Mostly Uused Products by 50000+ Subscribers

4. Compilation fails only at line n2






Question : Given the following code for a, what is the output?
 : Given the following code for a, what is the output?
1. [LQ59.HadoopExamApp;@2a139a55
Q59.HadoopExamApp.Moon@15db9742

2. [LQ59.HadoopExamApp;@2a139a55
Q59.HadoopExamApp@15db9742

3. Access Mostly Uused Products by 50000+ Subscribers
Q59.Moon@15db9742

4. Runtime Error