Question
1. protected abstract void m1();
2. static final void m1(){}
3. synchronized public final void m1() {}
4. private native void m1();
a.
1 and 3
b.
2 and 4
c.
1 only
d.
All of them are legal declarations.
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which of the following is/are legal method declarations? 1. protected abstract void m1(); 2. static final void m1(){} 3. synchronized public final void m1() {} 4. private...
Similar Questions
Discover Related MCQs
Q. Which cause a compiler error?
View solution
Q. Which three are valid method signatures in an interface?
1. private int getArea();
2. public float getVol(float x);
3. public void main(String [] args);
4. public static void main(String [] args);
5. boolean setFlag(Boolean [] test);
View solution
Q. You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
View solution
Q. Which one creates an instance of an array?
View solution
Q. Which two of the following are legal declarations for nonnested classes and interfaces?
1. final abstract class Test {}
2. public static interface Test {}
3. final public class Test {}
4. protected abstract class Test {}
5. protected interface Test {}
6. abstract public class Test {}
View solution
Q. Which of the following class level (nonlocal) variable declarations will not compile?
View solution
Q. Which three statements are true?
1. The default constructor initialises method variables.
2. The default constructor has the same access as its class.
3. The default constructor invokes the no-arg constructor of the superclass.
4. If a class lacks a no-arg constructor, the compiler always creates a default constructor.
5. The compiler creates a default constructor only when there are no other constructors for the class.
View solution
Q. What is the numerical range of char?
View solution
Q. Which of the following are Java reserved words?
1. run
2. import
3. default
4. implement
View solution
Q. Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?
View solution
Q. Which class does not override the equals() and hashCode() methods, inheriting them directly from class Object?
View solution
Q. Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?
View solution
Q. You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability?
View solution
Q. Which interface does java.util.Hashtable implement?
View solution
Q. Which interface provides the capability to store objects using a key-value pair?
View solution
Q. Which collection class allows you to associate its elements with key values, and allows you to retrieve objects in FIFO (first-in, first-out) sequence?
View solution
Q. Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?
View solution
Q. Which is valid declaration of a float?
View solution
Q. Which of the following are true statements?
1. The Iterator interface declares only three methods: hasNext, next and remove.
2. The ListIterator interface extends both the List and Iterator interfaces.
3. The ListIterator interface provides forward and backward iteration capabilities.
4. The ListIterator interface provides the ability to modify the List during iteration.
5.The ListIterator interface provides the ability to determine its position in the List.
View solution
Q. Which statement is true for the class java.util.ArrayList?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!