wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java" Watch "java" New topic
Author

java

phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hello all,

Can anyone tell me, how to assign a string to an object?



Property range = new property();
I have declared some attributes in the peoperty file

conditoned.properties:
CONDITIONED_MEASUREMANT_NAME:

Property range = new property();
CasacadePolicy cas = null;
cas = range.getProperty("CONDITIONED_MEASUREMANT_NAME");
It is giving an error that cannot convert from string to an object

Please give me some suggestions

thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I don't know what these CasacadePolicy and Property classes are, but obviously
getProperty() returns a String, not a CasacadePolicy. Check the API for both.
Does the Property class have a method returning a CasacadePolicy ?
Does the CascadePolicy class have a method passing a Policy as an argument ?


[My Blog]
All roads lead to JavaRanch
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Another thing to check is what version of the compiler are you using? What is the compliance level? You may have better luck with jdk compliance level of 5 or 6 as opposed to 1.4.

Are you using eclipse as an IDE? If so, look into Window - Preferences -Java - Compiler...

Of course, I could be totally off base too....
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by lakshmi manepally:
...It is giving an error that cannot convert from string to an object

Please give me some suggestions...

Can you post the exact error you're getting?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
the excat error:
Type mismatch: cannot convert from string to measure.casadePolicy()
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by lakshmi manepally:
the excat error:
Type mismatch: cannot convert from string to measure.casadePolicy()

Is this the complete error message? Where's the line number?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java