Forums Register Login

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

+Pie Number of slices to send: Send
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.

+Pie Number of slices to send: Send
 

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 )?
+Pie Number of slices to send: Send
Showing Lesson5Activityl9 is a public class,
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks for your time and effort. I will recompile and start over. Thanks Danny.
Just the other day, I was thinking ... about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 3581 times.
Similar Threads
Weird problem in Windows 7 and Ubuntu 10.10 in a java application
Help with drawString that needs to change colors
JButton onClick change background color
Menu Clears Out Graphics
I want to draw circle with mouse dragged in below program.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:18:20.