READ Free Dumps For Oracle- 1z0-804
Question ID 21415 | Given:
interface Rideable {
String ride() ;
}
class Horse implements Rideable {
String ride() { return "cantering "; }
}
class Icelandic extends Horse {
String ride() { return "tolting "; }
}
public class Test1 {
public static void main(String[] args) {
Rideable r1 = new Icelandic();
Rideable r2 = new Horse();
Horse h1 = new Icelandic();
System.out.println(r1.ride() + r2.ride() + h1.ride());
}
}
What is the result?
|
Option A | tolting cantering tolting
|
Option B | cantering cantering cantering
|
Option C | compilation fails
|
Option D | an exception is thrown at runtime
|
Correct Answer | C |
Explanation Explanation: C: compilation fails Compiler says: Cannot reduce the visibility of the inherited method from Rideable. müssen PUBLIC sein public String ride() { return "cantering "; } public String ride() { return "tolting "; } if this is given then the result would be: A : tolting cantering tolting
Question ID 21416 | Which four are syntactically correct?
|
Option A | package abc;
package def;
import Java.util . * ;
public class Test { }
|
Option B | package abc;
import Java.util.*;
import Java.util.regex.* ;
public class Test { }
|
Option C | import java.util.*;
public class Test{}
|
Option D | import Java.util.*;
package abc;
public class Test {}
|
Option E | package abc;
import java.util. *;
public class Test{}
|
Option F | package abc;
public class test {}
|
Correct Answer | B,C,E,F |
Explanation