About 311,000 results
Open links in new tab
  1. What is the difference between local and instance variables in Java ...

    Jan 18, 2010 · Except the scope and the storage differences, are there any other major difference between instance and local variables in Java?

  2. Why must local variables, including primitives, always be initialized ...

    Oct 13, 2009 · Why must local variables, including primitives, always be initialized in Java? Why is the same not applicable in the case of instance variables?

  3. Why would one mark local variables and method parameters as …

    Nov 21, 2011 · Making local variables and method parameters final is essential if you want to pass those parameters into anonymous classes - like you instantiate an anonymous Thread …

  4. java - Difference between final and effectively final - Stack Overflow

    Jan 6, 2014 · I'm playing with lambdas in Java 8 and I came across warning local variables referenced from a lambda expression must be final or effectively final. I know that when I use …

  5. java - Variable used in lambda expression should be final or ...

    Jan 19, 2016 · Java 8 realized the pain of declaring local variable final every time a developer used lambda, introduced this concept, and made it unnecessary to make local variables final.

  6. How do I create a static local variable in Java? - Stack Overflow

    Jan 17, 2010 · Although Java doesn't support static local variables, it's fairly easy to emulate in recent versions of Java. From Java 16 onwards, it is possible to create a local class with a …

  7. java - Modifying local variable from inside lambda - Stack Overflow

    May 4, 2015 · Modifying a local variable in forEach gives a compile error: Normal int ordinal = 0; for (Example s : list) { s.setOrdinal(ordinal); ordinal++; } With Lambda int

  8. Why are local variables not initialized in Java? - Stack Overflow

    Before Java 7, instance variables are stored on the heap and local variables are found on the stack. However, any object that a local variable references will be found in the heap.

  9. java - Lambdas: local variables need final, instance variables don't ...

    Jul 31, 2014 · Let be known that at least with the latest version of the compiler java 1.8 local variables only need to be effectively final so they don't need to be declared final per se but the …

  10. java - local variables referenced from a lambda expression must be ...

    local variables referenced from a lambda expression must be final or effectively final Asked 11 years ago Modified 5 years, 11 months ago Viewed 147k times