can we write implementation for a method with in another
method?

Answers were Sorted based on User's Feedback



can we write implementation for a method with in another method?..

Answer / sharan raj

Yes, a method can be implemented within another method
using anonymous class.
using anonymous class: new ClassName({...});
For more details regarding anonymous class refer any java
document.

Is This Answer Correct ?    29 Yes 4 No

can we write implementation for a method with in another method?..

Answer / sumitpalsingh

Yes,we can write one method implementation inside another method.

public class ImplementMethodEx {
public void m1(){
System.out.println("M1-Method Impl.");
}
public void m2()
{
m1();
}
public static void main(String[] args) {
ImplementMethodEx obj=new ImplementMethodEx();
obj.m2();

}

}

Is This Answer Correct ?    0 Yes 0 No

can we write implementation for a method with in another method?..

Answer / krish

No, you cannot implement a method in side a method.it gives
you a compile error.

Is This Answer Correct ?    5 Yes 18 No

Post New Answer

More Advanced Java Interview Questions

Name the method to find, if a thread is active or not?

2 Answers  


Write a program on RMI and JDBC using StoredProcedure?

1 Answers  


Can a thread be a member of another thread?

2 Answers  


JMS based on what technology?

1 Answers  


what is the difference between System.out.println and out.println in java

10 Answers   CTS,






What are skeletons and stubs and how they are generated?

2 Answers  


What are the states associated in the thread?

3 Answers  


What is Servlet Filter And What does it work?

1 Answers   TCS,


Where can I find seam examples and documentation?

0 Answers  


What invokes a thread?s run() method?

2 Answers  


how we can implement interface in jsp ?

2 Answers   Google,


When a thread terminates its processing, it enters into what state?

1 Answers  


Categories