| | |
Cannot find symbol, Constructor...
![]() |
•
•
Join Date: May 2005
Posts: 2
Reputation:
Solved Threads: 0
Hi people I'm new to posting here so sorry if I get the code wrapping thing wrong
Bascially I think I'm having a heirachy problem and its probably really obvious.
This is the the class with the error. The top line gives me an error saying cannot find symbol, constructor Something().
and this is the class I'm trying to refer to..
Hope this comes out properly. Would be thankful for any help
Bascially I think I'm having a heirachy problem and its probably really obvious.
This is the the class with the error. The top line gives me an error saying cannot find symbol, constructor Something().
Java Syntax (Toggle Plain Text)
public class ExecutionStackDemo extends Something { public static void m2(Something sth) { int i = 3; sth.grow(2 * i); i = 4711; if (sth.isNegative()) { sth.grow(i); } } public static void main(String[] args) { int i = -2; Something s = new Something(i); m2(s); } }
and this is the class I'm trying to refer to..
Java Syntax (Toggle Plain Text)
public class Something { public int n; public Something(int n) { this.n=n; } public void grow(int d) { this.n += d; } public boolean isNegative() { return (this.n < 0); } public String toString() { return ("something(" + this.n + ")"); }
Hope this comes out properly. Would be thankful for any help
I don't know if I'm right, but I think it's because you've not defined a constructor for ExeccutionStackDemo. IIRC, the default constructor in Java is something like
and since Something doesn't have a blank constructor, the default one in ExecutionStackDemo is screwing up. Why do you need the extends clause though? It's not like ESD is at all related to Something...
Java Syntax (Toggle Plain Text)
Classname() { super(); }
![]() |
Similar Threads
- ArrayList Help (Java)
- Cannot find symbol (Java)
- how to store item and invoke from it (Java)
- cant construct rectangle (Java)
- Another "cannot find symbol" compiling error (Java)
- Cannot resolve symbol (Java)
Other Threads in the Java Forum
- Previous Thread: Action listener
- Next Thread: J2ME error - Unable to create MIDlet null
| Thread Tools | Search this Thread |
addball android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) button card class classes client code collision columns component constructor crashcourse css database designadrawingapplicationusingjavajslider draw eclipse ee error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image integration intellij j2me java javaarraylist javadoc javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia jvm linux loan loop method migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle phone physics plazmic print problem program programming project radio scanner server service set sharepoint smart sms smsspam software sql subclass support swing textfield threads tree trolltech unlimited utility windows






