Which of the following needs to be done so that LIGHT is printed on to the console?
Answer: B
Question 4
Question ID: UK8297722
Given code of Test.java file:
package com.examtest.ocp;
interface Rideable {
void ride(String name);
}
class Animal {}
class Horse extends Animal implements Rideable {
public void ride(String name) {
System.out.println(name.toUpperCase() + " IS RIDING THE HORSE");
}
}
public class Test {
public static void main(String[] args) {
Animal horse = new Horse();
/*INSERT*/
}
}
Which of the following options, if used to replace /*INSERT*/, will compile successfully and on execution will print EMMA IS RIDING THE HORSE on to the console?
Choose 4 options.
Answer: A,C
Question 5
Question ID: UK8292809
Consider below code of Test.java file:
package com.examtest.ocp;
public class Test {
public static void main(String[] args) {
System.out.println(add(90, 7));
System.out.println(add('a', 1)); //ASCII code for 'a' is 97 and 'b' is 98