aspose file tools
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 Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "methods in methods" Watch "methods in methods" New topic

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

Joined: Jul 08, 2003
Posts: 24189

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:
subject: methods in methods