Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes This must be embarrassingly simple Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "This must be embarrassingly simple" Watch "This must be embarrassingly simple" New topic

This must be embarrassingly simple

Dennis Noren

Joined: Jan 07, 2005
Posts: 15
With the following code:

I get the compile error:
'cannot resolve symbol' on line
Shape shape1 = new Shape(, shape1Name);

If I comment out that line, the code compiles successfully but I get the runtime error:

Exception in thread "main" java.lang.NoSuchMethodError: main

What is going on?

Java novice, J2SE 1.4.2<br />Some C, some OOA/OOD
Liam Tiarnach
Ranch Hand

Joined: Aug 06, 2004
Posts: 51

Let's see...

okay there is where you attempt to instantiate you Shape class, passing the arguement and shape1Name...

here is your constructor for Shape that take no arguments... So the compiler give you an error...
to fix this you will have to create a constructor that does take Color and StringBuffer as arguements...
[code] Shape (Color colorArg ,StringBuffer stringBufferArg){
// do stuff

- Liam...<br />- ' He who never sleeps... '
Dennis Noren

Joined: Jan 07, 2005
Posts: 15
Thanks -- that fixed it for the compile error. For the runtime error, it was that I needed to name the file the same as the class that had main in it.
I agree. Here's the link:
subject: This must be embarrassingly simple
It's not a secret anymore!