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 variable length arguments in java?
What is return in java?
What is data type example?
What is the purpose of the return statement?
What is default exception handling in java?
Difference between string, stringbuffer and stringbuilder?
What is the size of a string in java?
What is string in java? String is a data type?
What are heterogeneous objects?
Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..
Can we create constructor in abstract class ?
How to sort a collection of custom Objects in Java?
What is the purpose of the system class in java programming?
How do you find the absolute value?
Can we assign the reference to this variable?