Overview Null is neither an object nor a type a. itonlyonlyis a special value that you can assign to any reference type. B. During the compile and run times, it is possible to cast null to any reference type, and no null pointer exception is thrown during the run time.
Null can assigned to String
Can assign null to Integer Also
null; //Null can also is assigned to Double
Null can is type cast to String
It can also is type casted to Integer
Yes it ' s possible, no error
Any wrapper class that contains null values throws a null pointer exception when the Java unboxing generates a basic data type
Null
i = iamnull//remember-no compilation Error
If you use a reference type variable with a null value, the instanceof operation will return false
Null
System. out "False ");
Use simple techniques to avoid NULL pointer exceptions 1. When using the Equals () method, the known string is the base 2. For the string representation of an object, use String.valueof (obj) instead of obj.tostring () 3. Using the Null security method
//stringutils methods is null safe, they don ' t throw NullPointerException
System. out. println (Stringutils.isempty (NULL));//true
System. out. println (Stringutils.isblank (NULL));//true
System. out. println (Stringutils.isnumeric (NULL));//\false
System. out. println (Stringutils.isalluppercase (NULL));//false
4. The method avoids directly returning null, using Collections.empty_list, Collections.empty_set and Collections.empty_map instead of 5. Using @notnull, @Nullable annotations 6. Avoid unnecessary automatic unboxing
Person ("Ram");
Phone = Ram.getphone ();
At this point, if Getphone is an integer type and is empty, it will throw NullPointerException
From for notes (Wiz)
The NULL keyword for Java