2

Here is a small sample:

public class LocalClassSample {
    public static void main(String[] args) {
        class Utils {
            public void printHello(String name) {
                System.out.println("Hello " + name);
            }
            public String outHello(String name) {
                return "hello " + name; 
            }
        }

        Utils util = new Utils();
        util.printHello("World");
    }
}

I put a break point at the last line. I am able to view util in the Variables window...

enter image description here

I try to view the same variable in the expressions window...it is unable to evaluate:

enter image description here Update:

Even tried inspecting the variable in the Display View...it does not evaluate: enter image description here

1
  • Try moving the Utils class outside of main?
    – Sizik
    Feb 26, 2015 at 14:55

1 Answer 1

0

Expression eval a java expression like 'util.printHello("World")' and return the result ("Hello World"). 'util' is not an 'expression' but just a variable name, if you want to inspect it, use the Variables view or the Inspect command.

2
  • Same issue there too...I cannot inspect...updated that issue in question
    – deostroll
    Feb 26, 2015 at 14:46
  • it seems like Eclipse does not have visibility of an inner class using the Inspect command. If you externalize Utils class, you should be able to inspect 'util' variable!
    – vathek
    Feb 26, 2015 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.