Problem with constant defined in interface defined in class
Hacim Bengali <hacim_bengali-S0/[email protected]> Fri, 21 Nov 2008 10:39:22 +0100
| Newsgroups | gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a problem with a constant defined in an interface which is
defined in a class.
When the following program is run I get the output
"interface constant=null" instead of the expected out "interface
constant=constant":
import bsh.EvalError;
import bsh.Interpreter;
public class BshInterfaceConstantTest
{
public static void main(String[] args) throws EvalError
{
Interpreter interpreter = new Interpreter();
interpreter.setStrictJava(true);
String script =
"class FooBar {"
+" interface Bla {"
+" String CONSTANT = \"constant\";"
+" }"
+" public void perform() {"
+" System.out.println(\"interface constant=\"+Bla.CONSTANT);"
+" }"
+"}"
+"new FooBar().perform();";
interpreter.eval(script);
}
}
What is wrong with it?
Best regards
Hacim
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/