What is the difference between null, 0 and nothing?
问题 What is the difference between null , 0 and nothing ? I cannot find a question addressing all three of these. For example: If I am getting input from a string and parsing it to int . return Integer.parseInt(sc.nextLine()); Or if I am asking if a string != "" , or a is not nothing I am confused about which to use when and why. I am confused about which one to use when validating data. 回答1: null means that a variable contains a reference to a space in memory that does not contain an object. 0