Name: Anonymous 2012-03-20 11:01
Will the following code work in Java? I have a feeling it should, but it refuses to compile, saying that X has no such method getText().
class X
{
//class body
}
class main
{
public static void main(String[] args)
{
X x = new X() { public String getText() { return "asdf"; } }; System.out.println(x.getText());
}
}