Premium

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



Question : You have been given belwo interface declaration

interface Runnable {
public voide run();
}

Which of the following will create instance of Runnable type?

   : You have been given belwo interface declaration
1. Runnable run = 0 -> {
System.out.println("Run");
}
2. Runnable run = 0 -> System.out.println("Run");
3. Runnable run = 0 > System.out.println("Run");
4. Runnable run => System.out.println("Run");
5. None of above




Correct Answer : Get Lastest Questions and Answer :









Question : You have been given below Java Code

public class Painting {
private String type;

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public static void main(String[] args) {
Painting obj1 = new Painting();
Painting obj2 = new Painting();
obj1.setType(null);
obj2.setType("Fresco");
System.out.print(obj1.getType() + " : " + obj2.getType());
}
}

When you run it, what would be printed ?


   : 	You have been given below Java Code
1. : Fresco
2. null : Fresco
3. Fresco : Fresco
4. A NullPointerException is thrown at runtime




Correct Answer : Get Lastest Questions and Answer :









Question : You have been given below code

boolean log3 = (5.0 != 6.0) && (4 != 5);
boolean log4 = (4 != 4) || (4 == 4);
System.out.println("\n log3:" + log3 + "\n log4 : " + log4);

When you execute this code, what would be printed ?
   : 	You have been given below code
1. log3:false
log4:true
2. log3:true
log4:true
3. log3:true
log4:false
4. log3:false
log4:false





Correct Answer : Get Lastest Questions and Answer :
Explanation:









Related Questions


Question : You have been given below code

package WQ5;

abstract class A1 {
public abstract void m1();

public void m2() {
System.out.println("Green");
}
}

abstract class A2 extends A1 {
public abstract void m3();

public void m1() {
System.out.println("Cyan");
}

public void m2() {
System.out.println("Blue");
}
}

public class A3 extends A2 {
public void m1() {
System.out.println("Yellow");
}

public void m2() {
System.out.println("Pink");
}

public void m3() {
System.out.println("Red");
}

public static void main(String[] args) {
A2 tp = new A3();
tp.m1();
tp.m2();
tp.m3();
}
}

When you run it , what would be result ?


 : You have been given below code
1. Yellow Pink Red
2. Cyan Blue Red
3. Access Mostly Uused Products by 50000+ Subscribers
4. Compilation Fails




Question : You are writing a method that is declared not to return a value. Which two are permitted in the method body?

A. omission of the return statement
B. return null;
C. return void;
D. return;



 : You are writing a method that is declared not to return a value. Which two are permitted in the method body?
1. A,B
2. A,D
3. Access Mostly Uused Products by 50000+ Subscribers
4. C,D





Question : You have been given below code

import java.util.*;

public class Ref {
public static void main(String[] args) {
StringBuilder s1 = new StringBuilder("Hello Java!");
String s2 = s1.toString();
List lst = new ArrayList();
lst.add(s2);
System.out.println(s1.getClass());
System.out.println(s2.getClass());
System.out.println(lst.getClass());
}
}

When you run it, what would be result ?


 :  You have been given below code
1. class java.lang.String class java.lang.String class java.util.ArrayList
2. class java.lang.Object class java.lang. Object class java.util.Collection
3. Access Mostly Uused Products by 50000+ Subscribers
4. class java.lang.StringBuilder class java.lang.String class java.util.List






Question : Which usage represents a valid way of compiling java source file with the name "Main"?
 : Which usage represents a valid way of compiling java source file with the name
1. javac Main.java
2. java Main.class
3. Access Mostly Uused Products by 50000+ Subscribers
4. javac Main

5. java Main






Question : Given the classes:
- AssertionError
- ArithmeticException
- ArrayIndexOutofBoundsException
- FileNotFoundException
- IllegalArgumentException
- IOError
- IOException
- NumberFormatException
- SQLException

Which option lists only those classes that belong to the unchecked exception category?




  : Given the classes:
1. AssertionError, ArrayIndexOutOfBoundsException, ArithmeticException
2. AssertionError, IOError, IOException
3. Access Mostly Uused Products by 50000+ Subscribers
4. FileNotFoundException, IOException, SQLException
5. ArrayIndexOutOfBoundException, IllegalArgumentException, FileNotFoundException





Question : You have been given below code


Int[][] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}};
System.out.println(array [4][1]);
System.out.printIn (array) [1][4]);


What would be the result?

  : You have been given below code
1. 4 Null
2. Null 4
3. Access Mostly Uused Products by 50000+ Subscribers
4. 4 An ArrayIndexOutOfBoundException is thrown at run time