This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes get final static value from an interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "get final static value from an interface" Watch "get final static value from an interface" New topic
Author

get final static value from an interface

Joe Nguyen
Ranch Hand

Joined: Apr 20, 2001
Posts: 161
I need to retrieve value of a final static string in an interface. I don't know the interface name till run time. I cannot load the interface because no class implements the interface. Would you give me some suggestion?
Thanks
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

What do you mean you can't load the interface?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Helmut Lerch
Ranch Hand

Joined: Feb 11, 2001
Posts: 48
Hi,
Originally posted by Joey Tran:
I need to retrieve value of a final static string in an interface. I don't know the interface name till run time. I cannot load the interface because no class implements the interface. Would you give me some suggestion?
Thanks

I suppose the following code:
<pre>
public interface Inter {
public static String str = "String";
}
public class JustMain {
public static void main(String args[]) {
//retrieving the String
System.out.println(Inter.str);
System.exit(0);
}
}
</pre>
If I supposed wrong forget everything .
Heli

[This message has been edited by Helmut Lerch (edited October 04, 2001).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: get final static value from an interface