Re: Convert String to Object - Newbie Question
- From: Marion <mchew02@xxxxxxxxxxx>
- Date: Fri, 28 Sep 2007 13:09:52 -0700
This error likely has nothing to do with converting a String[] into anoh! (i'm relieved and apprehensive at the same time. :p) I've been
Object.
humbled last night in my search of converting a string to Object,
wow. I'll take your advice and stick to the more elementary stuff
until I'm comfortable with Java.
Getting back to the actual problem: "non-static method setData....cannot
be referenced from a static content.", the Java compile is complaining
about the line
Node.setData(dataString);
Because setData is a non-static method, you need to invoke the method
on a Node object (or an object that has Node as an ancestor class). In
the code that you have given there are no Node objects. In the
epression
Node.setData(dataString);
"Node" is the name of a class, not a reference to a Node object (an
instance of the class). Where it the Node object whose data you want to
I see! Ok, well, now that you ask, there is no Node object whose data
I want to change. I now have something to work with to progress in my
program. (going to create an object, then perform that method on it
and see what happens..oh boy i'm excited now.)
Onward with my learning experience with Java. I cannot thank you guys
enough confirming and/or correcting my understanding about objects, in
particular.
-t
.
- Follow-Ups:
- Re: Convert String to Object - Newbie Question
- From: Roedy Green
- Re: Convert String to Object - Newbie Question
- From: Lew
- Re: Convert String to Object - Newbie Question
- References:
- Convert String to Object - Newbie Question
- From: Marion
- Re: Convert String to Object - Newbie Question
- From: A. Bolmarcich
- Convert String to Object - Newbie Question
- Prev by Date: Re: encrypted source file support in jdk?
- Next by Date: Re: image loading problem in login page
- Previous by thread: Re: Convert String to Object - Newbie Question
- Next by thread: Re: Convert String to Object - Newbie Question
- Index(es):
Relevant Pages
|
|