Java Programming - Declarations and Access Control - Discussion

Discussion Forum : Declarations and Access Control - General Questions (Q.No. 7)
7.
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 native void m1();
1 and 3
2 and 4
1 only
All of them are legal declarations.
Answer: Option
Explanation:

All the given statements are legal declarations.

Discussion:
14 comments Page 2 of 2.

Amaziane said:   1 decade ago
I have some doubt that the declaration protected abstract void m1();

Compile, at least in my workspace with jdk7.

Karthik said:   10 years ago
Can you explain it clearly?

Jatinder Verma said:   10 years ago
There are only two method declarations:

1. Protected abstract void m1();

2. Private native void m1();

Except these all others are methods with definition.
(1)

Rahul said:   7 years ago
Public, static, final are all constant then how can we use final with static?
(2)


Post your comments here:

Your comments will be displayed after verification.