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.

Manohar said:   1 decade ago
static final void m1(){}

Can anyone explain it clearly?

Kaustubh Kaley said:   1 decade ago
Why are {} specified in the declaration?

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?


Post your comments here:

Your comments will be displayed after verification.