• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

What does - class, interface, or enum expected - mean?  RSS feed

 
Ranch Hand
Posts: 65
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question I have is... what does class, interface, or enum expected mean? The last five lines give me this answer class, interface, or enum expected. I also get no main class. Would you please help me.

 
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Danny Broadwater wrote:The question I have is... what does class, interface, or enum expected mean? The last five lines give me this answer class, interface, or enum expected. I also get no main class. Would you please help me.



We'll address the last five lines. But first, what is the following code supposed to do? Do those lines compile? If not, what does the compiler error say?


What is the program supposed to do ( What is your problem statement )?
 
Danny Broadwater
Ranch Hand
Posts: 65
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Showing Lesson5Activityl9 is a public class,
 
Chan Ag
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, the public keyword makes it a public class.

But what is the following part for?



Do we write the extends keyword inside the class body? Can a class inherit from more than one class?

Here is an example of the correct syntax of a class that extends another class.



In Java, a class cannot extend from more than one class ( Java does not allow multiple inheritance ). So the following is wrong.



Also the extends keyword goes with the class name outside the class body as shown in my first example. So the following would be wrong.



So given the above, how would you fix the first error in your code? Also my question still stands - what is your problem statement ( what is the program supposed to do )?

Chan.
 
Danny Broadwater
Ranch Hand
Posts: 65
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lesson 19: Create a line Drawing Application with Swing. I am using NetBeans IDE 7.4. I redid the main as follows:



The errors are as follows




I am thinking about starting over on this project.... But would like to hear what you say. I can see that I tried combining 2 classes together, and my ending brackets are all wrong, plus more problems. Thanks for your time and effort Danny.
 
Marshal
Posts: 62804
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have already been told not to combine two classes; if they are public they must be in separate files.
Sort out the first compiler error and re‑compile. This sort of printout shows the error of writing hundreds of lines and then compiling. Compile after every 5 lines; then the errors will be few and easier to find.
 
Danny Broadwater
Ranch Hand
Posts: 65
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your time and effort. I will recompile and start over. Thanks Danny.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!