This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Errors in Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Errors in Code" Watch "Errors in Code" New topic
Author

Errors in Code

Linda Weeks
Greenhorn

Joined: Dec 02, 2001
Posts: 3
Can you determine what I've done by these error messages? I've
tried everything I can think of. Thanks, Linda
A:\>javac Transfer.java
Transfer.java:137: Invalid method declaration; return type required.
clearTextFields();
^
Transfer.java:148: Class or interface declaration expected.
}
^
2 errors
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
<pre>A method declaration requires that something be returned, even if it is void. For example:
void clearTextFields()
{
// stuff
}

or

are you trying to call a method with this statement and have failed to put it inside another method?
class Test
{
clearTextFields(); // this statement won't work here

public static void main( String[] args )
{
clearTextFields(); // the same statement will work here
}

void clearTextFields()
{
// stuff
}

}

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
parul patidar
Ranch Hand

Joined: Sep 07, 2001
Posts: 53
perhapes u missed 1 '}' or u have an extra '{' in ur application
parul patidar
Originally posted by Linda Weeks:
Can you determine what I've done by these error messages? I've
tried everything I can think of. Thanks, Linda
A:\>javac Transfer.java
Transfer.java:137: Invalid method declaration; return type required.
clearTextFields();
^
Transfer.java:148: Class or interface declaration expected.
}
^
2 errors

Steve Campbell
Ranch Hand

Joined: Dec 18, 2000
Posts: 41
Linda,
Everytime I've received this error it was because a brace "}" was missing somewhere.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Errors in Code
 
Similar Threads
Redirect internal server error to custom JSP
prepared statement in jdbc
threads doubt
Array declaration error
Initializing in a constructor versus a declaration