Given the class definitions: And the code fragment of the main() method, What is the result?
A.
Java Java Java
B.
Java Jeve va
C.
Java Jeve ve
D.
Compilation fails
Given the class definitions: And the code fragment of the main() method, What is the result?
A.
Java Java Java
B.
Java Jeve va
C.
Java Jeve ve
D.
Compilation fails
B
A
B
just C. I test with code
public class Q103 {
public static void main(String[] args) {
List lst = new ArrayList();
lst.add(new Alpha());
lst.add(new Beta());
lst.add(new Gamma());
for (Alpha alpha : lst) {
System.out.println(alpha.doStuff(“Java”));
}
}
}
class Alpha {
public String doStuff(String msg){
return msg;
}
}
class Beta extends Alpha{
public String doStuff(String msg){
return msg.replace(“a”, “e”);
}
}
class Gamma extends Beta{
public String doStuff(String msg){
return msg.substring(2);
}
}
B
Run the programs. Its B
import java.util.ArrayList;
public class Person {
public static void main(String[] args) {
ArrayList lst = new ArrayList();
lst.add(new Alpha());
lst.add(new Beta());
lst.add(new Gamma());
for (Alpha alpha : lst) {
System.out.println(alpha.doStuff(“Java”));
}
}
}
class Alpha {
public String doStuff(String msg) {
return msg;
}
}
class Beta extends Alpha {
public String doStuff(String msg) {
return msg.replace(‘a’, ‘e’);
}
}
class Gamma extends Beta {
public String doStuff(String msg) {
return msg.substring(2);
}
}
b
Completed 1Z0-803 exam few days ago! Scored 90% (the passing line is 63% now)!!
Had 70 questions in my actual 1Z0-803 test.
Most of the questions are on Giving Code … tell the result, insert CODE, choose the best option …etc.
Only few questions on Java: advantages of the Java exception mechanism, benefits of using ArrayList over array, valid types for switch, Java Exception classes, two-dimensional array, improve the encapsulation of a class, java class declaration … and so on.
Used valid 1Z0-803 dumps from PassLeader (http://www.passleader.com/1z0-803.html) (272q VCE and PDF), almost all questions were same as my 1Z0-803 exam, valid enough for passing until now!
By the way, part of that 272q 1Z0-803 dumps are available here:
https://doc.co/n2Coe4
Good Luck!!!
Hi, that PassLeader 1z0-803 dumps and 1z0-804 dumps are available here for your reference:
1z0-803 dumps: https://drive.google.com/open?id=0B-ob6L_QjGLpLTRCUklsOUhhVFU
(The newest FULL VERSION is 272q now!!!)
More:
1z0-804 dumps: https://drive.google.com/open?id=0B-ob6L_QjGLpNmJNZm16M0E5RWs
(The newest FULL VERSION is 160q now!!!)
Good Luck!!!