Monday 4 July 2016

Can an inner class declared inside of a method access local variables of this method?

It’s possible if these variables are final.

  1. What can go wrong if you replace && with & in the following code:
  2. String a=null;
    if (a!=null && a.length()>10)
    {...}
  3. A single ampersand here would lead to a NullPointerException.


No comments:

Post a Comment