Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

methods in methods

 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic