Problem with constant defined in interface defined in class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problem with constant defined in interface defined in class

Hacim Bengali

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

import bsh.EvalError;
import bsh.Interpreter;

public class BshInterfaceConstantTest
        public static void main(String[] args) throws EvalError
                Interpreter interpreter = new Interpreter();
                String script =
                        "class FooBar {"
                        +"  interface Bla {"
                        +"    String CONSTANT = \"constant\";"
                        +"  }"
                        +"  public void perform() {"
                        +"    System.out.println(\"interface constant=\"+Bla.CONSTANT);"
                        +"  }"

                        +"new FooBar().perform();";

What is wrong with it?

Best regards

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
Beanshell-users mailing list
[hidden email]