aspose file tools*
The moose likes Beginning Java and the fly likes Am a beginner - Function is not returning the value - everything seems to be fine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Am a beginner - Function is not returning the value - everything seems to be fine" Watch "Am a beginner - Function is not returning the value - everything seems to be fine" New topic
Author

Am a beginner - Function is not returning the value - everything seems to be fine

ganapathy ramadass
Greenhorn

Joined: Aug 15, 2012
Posts: 4



output error:


R. Jain
Ranch Hand

Joined: Aug 11, 2012
Posts: 375
    
    1

Hello ganapathy,
Welcome to CodeRanch..

First of all, we would like you know some important things before you start using CodeRanch..
I would suggest you to see this link -> How To Ask Questions At JavaRanch..

Now, as for your problem, I can see that your method declaration is not correct, plus there are some more problems with your code..
You can visit JavaBeginnersFAQ for some important links that can help you..

Here's is a general class with two methods: -
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

You have defined the nooftimes() method, lines 6 to 9, inside your main() method.

In Java you cannot define methods inside methods. Move lines 6-9 outside the main() method. You'll also need to make the nooftimes() method static.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
ganapathy ramadass
Greenhorn

Joined: Aug 15, 2012
Posts: 4

Jesper de Jong wrote:You have defined the nooftimes() method, lines 6 to 9, inside your main() method.

In Java you cannot define methods inside methods. Move lines 6-9 outside the main() method. You'll also need to make the nooftimes() method static.



thank you now i understand it clearly
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1771
    
    7

Welcome to JavaRanch indeed!
I've edited your post to make it the code more readable, as you may have noticed. You can do this yourself easily, all you have to do is UseCodeTags when you post a code snippet and the forum will add syntax highlighting and line numbers. Also a quick tip: if you want to copy text from the command-line output in Windows, all you have to do is right-click in the CMD window, choose mark from the menu, highlight the text you want to copy and hit enter. Then you can simply paste the text here. It saves you the hassle of having to create and upload image files.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
ganapathy ramadass
Greenhorn

Joined: Aug 15, 2012
Posts: 4

Jelle Klap wrote:Welcome to JavaRanch indeed!
I've edited your post to make it the code more readable, as you may have noticed. You can do this yourself easily, all you have to do is UseCodeTags when you post a code snippet and the forum will add syntax highlighting and line numbers. Also a quick tip: if you want to copy text from the command-line output in Windows, all you have to do is right-click in the CMD window, choose mark from the menu, highlight the text you want to copy and hit enter. Then you can simply paste the text here. It saves you the hassle of having to create and upload image files.


yaa here after i follow this
ganapathy ramadass
Greenhorn

Joined: Aug 15, 2012
Posts: 4

and the corrected code is....

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39396
    
  28
The idea of code tags is to show your indentation. Your code without indentation is very difficult to read.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Am a beginner - Function is not returning the value - everything seems to be fine