AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-804





Question ID 21423

Given the classes:
class Pupil {
String name = "unknown";
public String getName() { return name; }
}
class John extends Pupil {
String name = "John";
}
class Harry extends Pupil {
String name = "Harry";
public String getName() { return name; }
}
public class Director {

public static void main(String[] args) {
Pupil p1 = new John();
Pupil p2 = new Harry();
System.out.print(p1.getName() + " ");
System.out.print(p2.getName());
}
}
What is the result?

Option A

John Harry

Option B

unknown Harry

Option C

john unknown

Option D

unknown unknown

Option E

Compilation fails.

Option F

An exception is thrown at runtime.

Correct Answer B
Explanation Explanation: getName() is missing in John, hence Pupils getName() is invoked and the String in Pupils scope returned.


Question ID 21424

Given:
interface Writable {
void write (String s);
}
abstract class Writer implements Writable {
// Line ***
}
Which two statements are true about the writer class?

Option A

It compiles without any changes.

Option B

It compiles if the code void write (String s); is added at line***.

Option C

It compiles if the code void write (); is added at line ***.

Option D

It compiles if the code void write (string s) { } is added at line ***.

Option E

It compiles if the code write () {}is added at line ***.

Correct Answer A
Explanation Explanation: An abstract class does not need to implement the interface methods.

Send email to admin@getfreedumps for new dumps request!!!