I was once reading the interesting article and so I decided to share on this blog:
link
link
public class NaN {
public static void main(String[] args) {
double d = 2.0 / 0.0;
System.out.println(d);
}
}
public class NaN {
public static void main(String[] args) {
double d = 0.0 / 0.0;
System.out.println(d);
}
}
NaN
list
final means that you cannot reassign the list
variable to another object.list
variable once it has received its value. This can reduce complexity and helps in understanding the semantics of your class/method. In this case you are usually better off by using good naming conventions and reducing method length (the class/method is already too complex to be easily understood).final
in an enclosing scope so that you can access them in the inner class. This way, Java can copy your final
variable into the inner class object (it will never change its value) and the inner class object does not need to worry what happens to the outer class object while the inner class object is alive and needs to access the value of that variable.