0% found this document useful (0 votes)
92 views

Abstract

The valid method signature in an interface is public boolean setFlag(Boolean [] test []), as interfaces can only contain public abstract methods. Interfaces allow multiple implementation inheritance by allowing a class to implement multiple interfaces. Members of an interface are never static. The keyword extends is used to specify that a class inherits from an interface, while implements specifies that a class implements an interface. The only legal field declaration within an interface is private final static int answer = 42. The final modifier prevents creating a subclass of a top level class.

Uploaded by

crazz1
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Abstract

The valid method signature in an interface is public boolean setFlag(Boolean [] test []), as interfaces can only contain public abstract methods. Interfaces allow multiple implementation inheritance by allowing a class to implement multiple interfaces. Members of an interface are never static. The keyword extends is used to specify that a class inherits from an interface, while implements specifies that a class implements an interface. The only legal field declaration within an interface is private final static int answer = 42. The final modifier prevents creating a subclass of a top level class.

Uploaded by

crazz1
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Topic: Abstract Classes, Interfaces

Which is a valid method signature in an interface?


private int getArea();
protected float getVol(float x);
public static void main(String [] args);
boolean setFlag(Boolean [] test []);
Which statement is true about interfaces?
Interfaces allow multiple implementation inheritance.
Interfaces can extend any number of other interfaces.
Members of an interface are never static.
Members of an interface can always be declared static.
Which statement is true about interfaces?
The keyword extends is used to specify that an interface inherits from another
interface.
The keyword extends is used to specify that a class inherits from an interface.
The keyword implements is used to specify that an interface inherits from another
interface.
The keyword implements is used to specify that a class inherits from another class.
Which of the field declaration is legal within the body of an interface?
protected static int answer = 42;
volatile static int answer = 42;
int answer = 42;
private final static int answer = 42;
Which declaration prevents creating a subclass of a top level class?
private class Javacg{}
abstract public class Javacg{}
final public class Javacg{}
final abstract class Javacg{}

You might also like