• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Errors in Code

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<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
}

}
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Linda,
Everytime I've received this error it was because a brace "}" was missing somewhere.
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic