Have run the CounterDemo.class again. It worked well now.
I have had another question on how to run the Subclass program. "java
Subclass" showed a "NoSuchMethodError" in thread "main" Of course I
have a "public class Subclass extends Class {" statement in my
Subclass.java file. I can compile Subclass and SubSubclass java files.
Just don't know how to run these class files.
TIA,
Jeffrey
> Have run the CounterDemo.class again. It worked well now.
>
> I have had another question on how to run the Subclass program.
Huh? What 'Sublcass' program? Is this something you are
writing yourself?
Note that 'Subclass' is not written according to the correct
nomenclature for a class name, which is EachWordUpperCase.
If you want to name it as an extension of another class, it
might make sense to add the name of the super class. E.G.
'CounterDemoSubClass'
>.. "java
> Subclass" showed a "NoSuchMethodError" in thread "main"
Please copy/paste output rather than 'describing' it to us..
<http://www.physci.org/codes/javafaq.jsp#exact>
>... Of course I
> have a "public class Subclass extends Class {" statement in my
> Subclass.java file.
You are telling the compiler that 'Class' class has a
main(String[] args)
..method. Is that correct? Doi you see a 'main' here?
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#method_summary>
OTOH, why the heck are you extending 'Class' rather than a
class related to the Counter classes?
Are you still working on the counter example, is this code
supposed to be related to that code in some way?
cjeffwang@yahoo.com - 01 Nov 2005 08:29 GMT
Andrew,
My Subclass question has nothing to do with the CounterDemo.
In fact, my question is, for a Super class and a Sub class, how do I
start to run the Sub class file?
Because both have no Main Method, I had the 'NoSuchMethodError". Later
on I added a "public static void main(String[] args) {" to my Sub java
file.
Compiling the Sub java file showed an 'illegal start of expressioin"
error message at the next statement immediately after the main method.
How can I start a Sub java file?
Jeffrey