Social Sciences, asked by Sambhawna9548, 1 year ago

Which of these legal method to declaration?

Answers

Answered by VAB111
0
Hello Guru's

The following questions from Kathy.

I won�t agree with the answer 5 (5 � private native void m1 () .
Because this method is ending with semicolon instead of curly brace.
Pls let me know am i wrong.

Question :-

5. How many of the following are legal method declarations?
1 � protected abstract void m1();
2 � static final void m1(){}
3 � transient private native void m1() {}
4 � synchronized public final void m1() {}
5 � private native void m1();
6 � static final synchronized protected void m1() {}

A. 1
B. 2
C. 3
D. 4
E. 5
F. All of them

Answer:-

5. E. Statements 1, 2, 4, 5, and 6 are legal declarations.
A, B, C, D, and F are incorrect because the only illegal declaration is 3; transient
applies only to variable declarations, not to method declarations. As you can see from these other examples, method declarations can be very extensive.
Answered by AJKR
0
Wich legal methods send correct question?
Similar questions