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 are the types of java languages?
What is java algorithm?
What are the advantages of functions?
Why do we need singleton class?
Difference between string, stringbuffer and stringbuilder?
What is singleton service?
Does unicode support all languages?
What is difference between null and void?
What is parsing a string?
What is append function?
What is the name of the java compiler?
Which one will take more memory: an int or integer?
What are the basics of core java?
Explain the differences between static and dynamic variables?
Can the garbage collection be forced by any means?