Free Oracle 1Z0-808 Exam Braindumps (page: 7)

Given:

  1. Option A
  2. Option B
  3. Option C
  4. Option D

Answer(s): C



Given:



Which of the following is equivalent to the above code fragment?

  1. System.out.printLn(x>10?">, ': "<":, '=");
  2. System.out.println(x>10? ">"?"<":"=");
  3. System.out.println(x>10?">":x<10?"<":"=");
  4. System.out.printLn(x>10?">"?, '<"?"=");
  5. None of the above

Answer(s): B

Explanation:

Option A is incorrect as we can't use abstract with non abstract method, (here method has method body.)
Option C is incorrect as when overriding method we can't use more restrictive access
modifier, so trying to use private to override default access Level method causes a compile time error.
Option D is incorrect as default methods (not methods with default access level) are allowed only in interfaces.
Option E is incorrect as method all ready has void as return type, so we can't add int there. Option B is correct as we can use final there, since the method is non abstract https://docs.oracle.com/javase/tutorial/java/landl/polymorphism.html



Given:
public class Test {
public static void main(String[] args) {
try {
String[] arr =new String[4];
arr[1] = "Unix";
arr[2] = "Linux";
arr[3] = "Solarios";
for (String var : arr) {
System.out.print(var + " ");
}
} catch(Exception e) {
System.out.print (e.getClass());
}
}
}


What is the result?

  1. Unix Linux Solaris
  2. Null Unix Linux Solaris
  3. Class java.lang.Exception
  4. Class java.lang.NullPointerException

Answer(s): B

Explanation:

null Unix Linux Solarios
The first element, arr[0], has not been defined.



Given:
Given:
public class SuperTest {
public static void main(String[] args) {
statement1
statement2
statement3
}
}
class Shape {
public Shape() {
System.out.println("Shape: constructor");
}
public void foo() {
System.out.println("Shape: foo");
}
}
class Square extends Shape {
public Square() {
super();
}
public Square(String label) {
System.out.println("Square: constructor");
}
public void foo() {
super.foo();
}
public void foo(String label) {
System.out.println("Square: foo");
}
}
}
}
What should statement1, statement2, and statement3, be respectively, in order to produce the result?
Shape: constructor
Square: foo
Shape: foo

  1. Square square = new Square ("bar");
    square.foo ("bar");
    square.foo();
  2. Square square = new Square ("bar");
    square.foo ("bar");
    square.foo ("bar");
  3. Square square = new Square ();
    square.foo ();
    square.foo(bar);
  4. Square square = new Square ();
    square.foo ();
    square.foo("bar");
  5. Square square = new Square ();
    square.foo ();
    square.foo ();
  6. Square square = new Square();
    square.foo("bar");
    square.foo();

Answer(s): F



Viewing page 7 of 60
Viewing questions 25 - 28 out of 245 questions



Post your Comments and Discuss Oracle 1Z0-808 exam prep with other Community members:

1Z0-808 Exam Discussions & Posts