File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes illegal start of type! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "illegal start of type!" Watch "illegal start of type!" New topic
Author

illegal start of type!

dean lin
Greenhorn

Joined: May 11, 2009
Posts: 3
Dear All

Please help me ! How can I solve this problem

After complier this code I got this error message

C:\Dean>javac Menu3.java
Menu3.java:62: illegal start of type
while(true){
^
Menu3.java:102: class, interface, or enum expected
}
^
2 errors

Thank you!

jittu goud
Ranch Hand

Joined: Mar 30, 2007
Posts: 46


you are referring a static main method argument from a nonstatic innner class...which is not allowed

the best way is read the arguments before the innerclass in to a final variable.........and use it in the code




r1.drawRect() returns a void ...so what do you want to print using a method which returns a void...

you can skip the print statement...and use the r1.drawRect(); directly
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

this is the error message i got when compiled:




The first error is self explainatory,

The second error means : what do you expect to be appended to string? the return type of the function is void.

Bad programming practices:

Defining a class in main
No proper indentations.
Conditional Statements, Loops whose statements are not in braces



My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
dean lin
Greenhorn

Joined: May 11, 2009
Posts: 3
Dear All

Thank you very much for your suggestion

I modify my code as below it can work now

But still don't understand this hint

Bad programming practices:

Defining a class in main
No proper indentations.
Conditional Statements, Loops whose statements are not in braces

Would you please explain it more detail or please give me some document about it

I will try to understand it






Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
The Rectangle class ought to be in a file of its own.
For the other things, have a look at our Chicken Coop.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: illegal start of type!