Is it OK to have a method(s) within a method? An example would be to have a method called fn within main all within a class. Is this OK to do?
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
posted
0
Yes, if that method is within a class that's within a method. In this case the method will belong to the "inner class" that's within the outher method. I hope I said that right. :-)
------------------ Bosun SCJP for the Java� 2 Platform
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
jason adam
Chicken Farmer ()
Ranch Hand
Joined: May 08, 2001
Posts: 1932
posted
0
You could call a method from within a method as long as the calling method can actually see the method it is calling (static vs. instance) You cannot do something like this though:
The only thing close to that is what Bosum suggested, putting an inner class within the method. That inner class would contain a method itself, but it would be within the scope of the class, and not really the method the class was built in. Clear as mud? Jason [This message has been edited by jason adam (edited November 13, 2001).]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.