wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes methods in methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "methods in methods" Watch "methods in methods" New topic
Author

methods in methods

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

may i know why this does not this program get compiled?



public class HelloName{
public static void main(String args[]){

void abc(){ }

}
}
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Because you're trying to define a method inside another method, something the Java language does not allow? Some folks recently had a discussion about this very thing here; check it out if you're interested.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: methods in methods
 
Similar Threads
Reflections Overloaded Methods
JavaBeans standard method name?
Session Beans Callback methods?
Working classes alive and well - its official!
How to disable copy and paste in a JTextField