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 the current version of java?
What is parsing and its types?
Does A Class Inherit The Constructors Of Its Superclass?
Is an array a vector?
Can you extend main method in java?
What is the difference between static binding and dynamic binding?
what is singleton class in java?
What do you mean by stream pipelining in java 8?
what is the use of bean managed and container managed with example?
what r advatages of websphere? & how to deploy?
What is the difference between Java1.4 and Java1.5
What do the thread?class methods run() and start() do?
What is serialversionuid?
What's a method in programming?
Difference between ‘>>’ and ‘>>>’ operators in java?