JAVA 1 Suppose the classes ScaryClown and FunnyClown extend

JAVA

1 Suppose the classes ScaryClown and FunnyClown extend the abstract class Clown. Which of the following is/are correct?

Clown is a subclass of ScaryClown
Clown is a superclass of ScaryClown
ScaryClown also extends FunnyClown
Clown is the parent class of FunnyClown
FunnyClown is a subclass of Clown

2 Consider the following code:

public class MyClass{

    private String myString;

    public void setMyString(String myString){

        this.myString = myString;

    }

// code omitted

}

Which statement is correct about the line this.myString = myString?

this.myString refers to the variable myString that is declared in the parameter list of the method
this.myString refers to the instance variable myString
the myString shown after the assignment operator refers to the instance variable myString
the myString shown after the assignment operator refers to the instance variable myString
none of the above

3 Which statements(s) is/are true of OOP in Java?

Every object is an instance of a class
Every class except Object inherits from Object
It is possible to determine from the code for a class what its parent class is
It is possible to determine from the code for a class whether it has any subclasses
It is possible to determine from the code for a class whether it implements a Java interface
It is possible to determine from the code for a Java interface which classes, if any, implement it

4 Which statement is false?

Concrete classes can declare instance variables
Abstract classes can declare instance variables
Abstract classes can contain concrete methods
Concrete classes can contain abstract methods
Java interfaces can contain finals

5 In Java, if you write a class without using the extends keyword, the class will be a subclass of the class named

Class
String
Interface
Object
System

Solution

Please refer to the answers below : to make it easier I have taken the lines as options.   1) b, d, e
2) a
3) a,b ,c ,e
4) b
5) object

JAVA 1 Suppose the classes ScaryClown and FunnyClown extend the abstract class Clown. Which of the following is/are correct? Clown is a subclass of ScaryClown C
JAVA 1 Suppose the classes ScaryClown and FunnyClown extend the abstract class Clown. Which of the following is/are correct? Clown is a subclass of ScaryClown C

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site