Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

class, interface, or enum expected, what does this mean?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator






These are my 2 sections of code that i think the problem is in. when i complie i get an error message on the public void processJButtonActionPerformed line saying. IncomeTax.java:180: class, interface, or enum expected. Ive googled it and the only thing i can find says i missed a semicolon or misspelled something, but it looks good to me. :/

 
Marshal
Posts: 28288
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It means that at that point in the code, it expects you will be starting another class (or interface or enum). If you aren't, then you have too many closing braces above there. Review your matching of braces and indentation of code.
 
John Beese
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah ok, this is my first multi class program, I'll finish writing and see what happens. Thanks
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is probably a mistake. if your current code is 200 lines, it is much easier to find the problem now than after writing an additional 200 lines.

right now, you're saying "I can't find the needle in this haystack, so I'm going to add MORE hay, and hope I find it".
 
Greenhorn
Posts: 17
Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey there,
It can be a mistake as simple as missing a semicolon in lines preceding Line Number 180 (the line where you said error is reported). So better fix this first before writing more code.
 
Marshal
Posts: 79637
380
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Missing a semicolon is very unlikely to produce that particular error.
 
John Beese
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:That is probably a mistake. if your current code is 200 lines, it is much easier to find the problem now than after writing an additional 200 lines.

right now, you're saying "I can't find the needle in this haystack, so I'm going to add MORE hay, and hope I find it".



well i wish i had read this before i went on writing all this other code, i wrote a bunch more stuff now im getting all sorts of errors from everywhere, and im really confused, Doesnt help Ive been getting pretty frustrated and changing stuff and re changing so now its just a big mess.
 
John Beese
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So i rewrote the code and most of it works.






Im getting a cant find symbol error message on the NetCalculator netCalculator; line
and the same error on netCalculator = new NetCalculator(grossEarnings,uncleSamsCut);

I used the same code for a dfifferent part of the program and it worked just fine, what gives?



 
Ranch Hand
Posts: 207
jQuery Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This error means that It could not find NetCalculator.class file in classpath.

If NetCalculator is defined in a different package then you will have to import it. Check your import statements.
 
John Beese
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im confused, I had 2 classes i needed to delcare a Tax Caculator class and a net Calculator, i did the same thing for both( I think) and i only get an error for the net calculator, Ive been doing this all day and im losing concentration. heres my entire import/ declare statement




this is almost my whole main method minus the clear and close commands



The 2 pieces of code for the CalculateTax and CalcNet have been written and are further down. Are you saying i need to declare it in the import statements section? Gonna rest on it and see if i cant figure it out tomorrow.
 
Piyush Joshi
Ranch Hand
Posts: 207
jQuery Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Picture is pretty unclear till now.

Can you show what is your directory structure, how many classes have you written and especially where in the directory are the NetCalculator,IncomeTax,TaxCalculator classes defined.
 
John Beese
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MIssed a bracket, works fine now!
 
reply
    Bookmark Topic Watch Topic
  • New Topic