• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java

 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the excat error:
Type mismatch: cannot convert from string to measure.casadePolicy()
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic