The difference between nothing and null in the scala

1: nothing is for all types of sub-classes, he did not have a specific instance of an object, common applications: throws an exception, the program exit, wireless circulation.

2: nothing all types of subclasses, subclasses is null, no object Nothing, but can be used to define the type, method throws an exception as the return value type is nothing.

3: null reference type is a subclass of all, he is just an instance object null, and is mainly used for other JVM language interoperability.

Guess you like

Origin www.cnblogs.com/liangyan131/p/12014353.html
Recommended