Re: Error *cannot return a value from method whose result type is void*
From: FISH (joeking_at_merseymail.com)
Date: 07/28/04
- Next message: FISH: "Re: Error *cannot return a value from method whose result type is void*"
- Previous message: Jacob: "Re: What does "refactoring" of a project mean ?"
- In reply to: Charles: "Error *cannot return a value from method whose result type is void*"
- Next in thread: FISH: "Re: Error *cannot return a value from method whose result type is void*"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Jul 2004 05:05:25 -0700
xbrain21@yahoo.com (Charles) wrote in message news:<69696690.0407271045.a86440d@posting.google.com>...
> I am creating a program, but keep receiving the same error what I am
> trying to do is have it output a calendar. I have it where it outputs
> the month name and year inputted, and the days of the week. I can not
> however get it to return a value. It says "cannot return a value from
> method whose result type is void". If I change it to anything else I
> get the error "missing return statement". I have already been to:
Sometimes one error will mask anothers. I remember a couple of years
ago one Java novice posted his code to a web forum complaining that
he was getting one single compilation error on the first line. When
it was pointed out to him that the line contained a syntax error, he
retorted that he knew it did, but when he'd corrected the syntax the
compiler had given him over a hundred errors in the following code!
(True story!!)
Obviously if the method returns a value, it must say so in its defin-
ition. The true error is the "missing return statement". Take a close
look at the code in your method, and you'll see there is a route through
the code which allows the end of the method to be reached, and no return
value specified. Java is very strict on these things - a method either
always or never returns something - there isn't a 'sometimes' option. So
you need to ammend the code so all routes out will end in a valid return
statement.
-FISH- ><>
- Next message: FISH: "Re: Error *cannot return a value from method whose result type is void*"
- Previous message: Jacob: "Re: What does "refactoring" of a project mean ?"
- In reply to: Charles: "Error *cannot return a value from method whose result type is void*"
- Next in thread: FISH: "Re: Error *cannot return a value from method whose result type is void*"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|