Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2007, 12:44 PM
Member
 
Join Date: Nov 2007
Posts: 4
jeneal is on a distinguished road
Compiler Error
So I'm working on my final project for class and having issues getting the final part to work. Basically this program takes 5 inputs and puts them in a text file. As long as everything in the inputs it correct, it writes fine. However, the issue lies when the user does not know the city or the zipcode for the address. They are instructed to type 0, and the program will fill it in for them. This is whats not working. I am getting a compiler error on line 76 stating"invalid method declaration; return type required" I know I am close, I call feel it, I just can't figure this one out. Please help, I am trying my hardest and spent the past 12 hours working through this all, I'm ready to scream.

Thank you.

Last edited by jeneal : 12-13-2007 at 02:33 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-13-2007, 01:36 PM
Member
 
Join Date: Dec 2007
Posts: 11
gulapala is on a distinguished road
Hi jeneal
Please check the declaration of build2dArray(String[] otherArray). It is defined as public build2dArray(String[] otherArray) without any return types. It should be either public void build2dArray(String[] otherArray) or public String build2dArray(String[] otherArray). The latter should be correct choice.

Check it once again and compile it.
__________________
Thanks & Regards, G.Rajasekhar
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-13-2007, 01:39 PM
Member
 
Join Date: Dec 2007
Location: Roggwil, Switzerland
Posts: 8
daprodigy is on a distinguished road
like you wrote ... the problem is line 76. the declaration:

public build2dArray(String[] otherArray)

this declaration misses the return-object-type. you have to write:

public String build2dArray(String[] otherArray)

... then you have to edit the return values:

line 99: return (String (city)); ... String (city) is interpreted as function call ... you can write: return city;

same issue at line 116

line 124: write return "";

... then you can compile the code.

greets
daprodigy
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-13-2007, 02:13 PM
Member
 
Join Date: Nov 2007
Posts: 4
jeneal is on a distinguished road
Thank you
Both of you, thank you for responding and not making me feel like a complete fool, as I have run across quite a bit.

If you don't mind, I have a few more questions.
I have corrected the code as suggested, and it compiles, however when I run it, I get this "java.lang.NoSuchMethodError: main
Exception in thread "main" " I don't know what it means, I have a main method.

Thank you again.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-13-2007, 02:31 PM
Member
 
Join Date: Nov 2007
Posts: 4
jeneal is on a distinguished road
I fixed it. Everything is working correctly. Thank you so much for your help, now I get to sleep ^_^
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 12-13-2007, 02:31 PM
Member
 
Join Date: Dec 2007
Location: Roggwil, Switzerland
Posts: 8
daprodigy is on a distinguished road
yepp, but ...

once again the declaration of the method is wrong

it has to be: public static void main (String[] args)

... don't worry ... all of us had the first steps in java

greets

daprodigy
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to solve "No compiler error"? iceman New To Java 5 04-22-2008 04:37 AM
compiler jidd New To Java 3 01-29-2008 01:40 PM
The best compiler for java baltimore New To Java 2 08-06-2007 06:10 PM
Asking for the compiler fernando Other IDEs 1 08-06-2007 10:04 AM
Help Finding Compiler error solution please jamesr2b New To Java 2 07-25-2007 02:13 PM


All times are GMT +3. The time now is 06:57 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org