Missing } return statement

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2008
Posts: 2
Reputation: jimzy2008 is an unknown quantity at this point 
Solved Threads: 0
jimzy2008 jimzy2008 is offline Offline
Newbie Poster

Missing } return statement

 
0
  #1
Apr 26th, 2008
I have an assignment for school that involves creating a java program that creates a basic class.

I'm getting an error missing return statement, if i try to compile.

What could be wrong here?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 121
Reputation: tonakai is an unknown quantity at this point 
Solved Threads: 11
tonakai's Avatar
tonakai tonakai is offline Offline
Junior Poster

Re: Missing } return statement

 
0
  #2
Apr 26th, 2008
missing return statement means that your method expects you to return a value. for example :
  1. int add(int x, int y) {
  2. return x+y;
  3. }

if your method does not return a value its signature need to be like this:
  1. void foo() {
  2. // some code here
  3. }
Good news, everyone!
aykutsoysal.com
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 2
Reputation: jimzy2008 is an unknown quantity at this point 
Solved Threads: 0
jimzy2008 jimzy2008 is offline Offline
Newbie Poster

Re: Missing } return statement

 
0
  #3
Apr 26th, 2008
yeah i duno if i can post my code on here, but if someone can reply, i need to see if i'm on the right track, i wanna send them my code in a private message and if its correct?

starting to bug me and i duno what im doing wrong. thx
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,844
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Missing } return statement

 
0
  #4
Apr 27th, 2008
Originally Posted by jimzy2008 View Post
yeah i duno if i can post my code on here, but if someone can reply, i need to see if i'm on the right track, i wanna send them my code in a private message and if its correct?

starting to bug me and i duno what im doing wrong. thx
Yeah, you can post your code here, that's the whole idea. PMs with code are discouraged on this site. It's better to post it for everyone so everyone can see it and people with the same problem can learn from it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 637 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC