Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get final static value from an interface

 
Joe Nguyen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean you can't load the interface?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Helmut Lerch
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic