1z0-808 | 10 Tips For Renew 1z0-808 dumps


Q131. Given: 

What is the result? 

A. True false 

B. True null 

C. Compilation fails 

D. A NullPointerException is thrown at runtime 

Answer:

Q132. Given: 

package p1; 

public interface DoInterface { 

void method1(int n1); // line n1 

package p3; 

import p1.DoInterface; 

public class DoClass implements DoInterface { 

public DoClass(int p1) { } 

public void method1(int p1) { } // line n2 

private void method2(int p1) { } // line n3 

public class Test { 

public static void main(String[] args) { 

DoInterface doi= new DoClass(100); // line n4 

doi.method1(100); 

doi.method2(100); 

Which change will enable the code to compile? 

A. Adding the public modifier to the declaration of method1 at line n1 

B. Removing the public modifier from the definition of method1 at line n2 

C. Changing the private modifier on the declaration of method 2 public at line n3 

D. Changing the line n4 DoClass doi = new DoClass ( ); 

Answer:

Explanation: Private members (both fields and methods) are only accessible inside the class they are declared or inside inner classes. private keyword is one of four access modifier provided by Java and its a most restrictive among all four e.g. public, default(package), protected and private. 

Read more: http://javarevisited.blogspot.com/2012/03/private-in-java-why-should-you-always.html#ixzz3Sh3mOc4D 

Q133. Given: 

What is the result? 

A. Compilation fails 

B. The code compiles, but does not execute. 

C. Paildrome 

D. Wow 

E. Mom 

Answer:

Q134. Given: 

And given the commands: 

javac Test.Java 

Java Test Hello 

What is the result? 

A. Success 

B. Failure 

C. Compilation fails. 

D. An exception is thrown at runtime 

Answer:

Q135. Given: 

public class X { 

static int i; 

int j; 

public static void main(String[] args) { 

X x1 = new X(); 

X x2 = new X(); 

x1.i = 3; 

x1.j = 4; 

x2.i = 5; 

x2.j = 6; 

System.out.println( 

x1.i + " "+ 

x1.j + " "+ 

x2.i + " "+ 

x2.j); 

What is the result? 

A. 3 4 5 6 

B. 3 4 3 6 

C. 5 4 5 6 

D. 3 6 4 6 

Answer:

Q136. Given the code fragment: 

Which statement is true? 

A. After line 8, three objects are eligible for garbage collection 

B. After line 8, two objects are eligible for garbage collection 

C. After line 8, one object is eligible for garbage collection 

D. After line 8, none of the objects are eligible for garbage collection 

Answer:

Q137. Given: 

interface Pet { } 

class Dog implements Pet { } 

public class Beagle extends Dog{ } 

Which three are valid? 

A. Pet a = new Dog(); 

B. Pet b = new Pet(); 

C. Dog f = new Pet(); 

D. Dog d = new Beagle(); 

E. Pet e = new Beagle(); 

F. Beagle c = new Dog(); 

Answer: A,D,E 

Explanation: 

Incorrect: 

Not B, not C: Pet is abstact, cannot be instantiated. 

Not F: incompatible type. Required Beagle, found Dog. 

Q138. Given: 

What is the result? 

A. Shining Sun Shining Sun Shining Sun 

B. Shining Sun Twinkling Star Shining Sun 

C. Compilation fails 

D. A ClassCastException is thrown at runtime 

Answer:

Q139. Given: 

public class String1 { 

public static void main(String[] args) { 

String s = "123"; 

if (s.length() >2) 

s.concat("456"); 

for(int x = 0; x <3; x++) 

s += "x"; 

System.out.println(s); 

What is the result? 

A. 123 

B. 123xxx 

C. 123456 

D. 123456xxx 

E. Compilation fails 

Answer:

Explanation: 123xxx 

The if clause is not applied. 

Note: Syntax of if-statement: 

if ( Statement ) { 

Q140. 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? 

A. Unix Linux Solaris 

B. Null Unix Linux Solaris 

C. Class java.lang.Exception 

D. Class java.lang.NullPointerException 

Answer:

Explanation: null Unix Linux Solarios 

The first element, arr[0], has not been defined.