Re: Problems with Constructor Methods
From: Chris Smith (cdsmith_at_twu.net)
Date: 11/27/04
- Previous message: JS: "Problems with Constructor Methods"
- In reply to: JS: "Problems with Constructor Methods"
- Next in thread: JS: "Re: Problems with Constructor Methods"
- Reply: JS: "Re: Problems with Constructor Methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Nov 2004 18:24:09 -0700
JS <dsa.@asdf.com> wrote:
> I guess class test and class NameLength has the same function. But why then
> has NameLength the line JOptionPane.showMessageDialog(null,
> "Finished!");
>
> And why does it have two c.readNameAndDisplayItsLength();
I don't know. I suppose it was just written that way. Do you mean that
you didn't write it?
> When i write: java NameLength I get the following error:
>
> NoSuchMethodError: HelperClass.readNameAndDisplayItsLength()V
> at NameLength.main(Johannes_Serup_48.java:149)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
Any chance that you've made the wrong code available to the Java virtual
machine?
A NoSuchMethodError never indicates a problem with your code; it means
that the virtual machine is finding different code than the compiler
found. Now, it just so happens that you've posted TWO different classes
both called HelperClass (bad idea, by the way; why not call one of them
HelperClass2, or something like that), and I bet the VM is finding the
wrong one.
-- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation
- Previous message: JS: "Problems with Constructor Methods"
- In reply to: JS: "Problems with Constructor Methods"
- Next in thread: JS: "Re: Problems with Constructor Methods"
- Reply: JS: "Re: Problems with Constructor Methods"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]