- 1

In which scenario do we use inner class?

16th Oct 2016, 5:53 AM
Subhash
Subhash - avatar
5 Antworten
+ 7
Rearrange the code to have an inner class Hand, which has a method called "shake" that prints "Hi": public class Person { class Hand { public void shake() { System.out.println("Hi"); } } } Unlock
16th Feb 2017, 2:15 PM
Ibrahim Al Quqa
Ibrahim Al Quqa - avatar
+ 2
When a class is for inner use only in the outer class, you don't want it to be used anywhere. It is part of the implementation not the API itself.
1st Nov 2016, 10:53 AM
Tamás Barta
Tamás Barta - avatar
+ 1
public class Person { class Hand { public void shake() { System.out.println("Hi"); } } }
25th Sep 2018, 1:41 PM
Yogesh Kharat
Yogesh Kharat - avatar
0
public class Person { class Hand { public void shake() { System.out.println("Hi"); } } }
1st Jan 2022, 8:10 AM
M.I.M.Aqueel
M.I.M.Aqueel - avatar
- 2
Rearrange the code to have an inner class Hand, which has a method called "shake" that prints "Hi". public void shake() { public class Person { class Hand { System.out.println("Hi"); } } } Unlock
2nd Nov 2016, 5:57 PM
ABINAYA SRI.A.M
ABINAYA SRI.A.M - avatar