Submitted by c-admin on Wed, 05/29/2019 - 00:55
Consider the following class and interface definitions (in separate files):
public class Sample implements IInt{
public static void main(String[] args){
Sample s = new Sample(); //1
int j = s.thevalue; //2
int k = IInt.thevalue; //3
int l = thevalue; //4
}
}public interface IInt{
int thevalue = 0;
}
What will happen when the above code is compiled and run?
Select 1 option
A. It will give an error at compile time at line //1.
B. It will give an error at compile time at line //2.
C. It will give an error at compile time at line //3
D. It will give an error at compile time at line //4.
E. It will compile and run without any problem.
Submitted by c-admin on Wed, 05/29/2019 - 00:50
Which of the following statements are correct?
Select 3 options
A. An abstract class can be extended by an abstract or a concrete class.
B. A concrete class can be extended by an abstract or a concrete class.
C. An interface can be extended by another interface.
D. An interface can be extended by an abstract class.
E. An interface can be extended by a concrete class.
F. An abstract class cannot implement an interface.
Submitted by c-admin on Wed, 05/29/2019 - 00:48
An abstract method cannot be overridden.
Select 1 option
A. True
B. False
Submitted by c-admin on Wed, 05/29/2019 - 00:46
Which of the following statements is/are true?
Select 1 option
A. Subclasses must define all the abstract methods that the superclass defines.
B. A class implementing an interface must define all the methods of that interface.
C. A class cannot override the super class's constructor.
D. It is possible for two classes to be the superclass of each other.
E. An interface can implement multiple interfaces.
Submitted by c-admin on Wed, 05/29/2019 - 00:44
Given:
//Insert code here
public abstract void draw();
}
//Insert code here
public void draw(){ System.out.println("in draw..."); }
}
Which of the following lines of code can be used to complete the above code?
Select 2 options
A. class Shape {
and
class Circle extends Shape {
B. public class Shape {
and
class Circle extends Shape {
C. abstract Shape {
and
public class Circle extends Shape {
D. public abstract class Shape {
and
class Circle extends Shape {
E. public abstract class Shape {
and
class Circle implements Shape {
F. public interface Shape {
and
class Circle implements Shape {
Pages