Answer Posted / janeesh
it is possible to write a method inside a method by using
method local inner classes.
Eg:
class Outer {
public void display() {
System.out.println("This is outerclass method.");
class Inner{
public void displayInner()
{
System.out.println("innerclass method");
}
}
Inner objC = new Inner();
objC.displayInner();
}
}
class MethodeInsideMethod {
public static void main(String[] args) {
Outer objC = new Outer();
objC.display();
}
}
Output:
This is outerclass method.
innerclass method
Is This Answer Correct ? | 11 Yes | 5 No |
Post New Answer View All Answers
What is a parameter in a function?
What exactly is methodology?
What are the various access specifiers in java?
What is a parameter in matrices?
Is array primitive data type in java?
What are wrapper classes in java?
What is unicode with example?
How many types of flags are there?
Do I need to import java.lang package any time? Why?
Explain about features of local inner class?
Write an algorithm for quick sort?
What is the use of generics? When was it added to the Java development Kit?
Wha is the output from system.out.println(“hello”+null); ?
What is the order of arraylist in java?
What is a string token?