- 1
In which scenario do we use inner class?
5 Respostas
+ 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
+ 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.
+ 1
public class Person {
class Hand {
public void shake() {
System.out.println("Hi"); }
} }
0
public class Person {
class Hand {
public void shake() {
System.out.println("Hi"); }
} }
- 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