The operator is undefined

前端 未结 3 1452
生来不讨喜
生来不讨喜 2020-12-17 03:47

I just tried to make a simple class that lets me figure out the length of a file:

public class Size {

    long s = 0;
    int a;

    public static void mai         


        
相关标签:
3条回答
  • 2020-12-17 04:03

    Primitive types in Java cannot be null. If you want to check for 0, do a != 0.

    0 讨论(0)
  • 2020-12-17 04:03

    Put a into an Integer object, which can be compared to null:

    Integer value = new Integer(a);
    
    while (value != null)
    {
        // Do stuff
    }
    
    0 讨论(0)
  • 2020-12-17 04:04

    you should assign (or) check NULL values only for a pointer. For integer values, initialise it to any number ,like a flag and check for that condition. NULL can be assigned or checked only with a pointer variable

    0 讨论(0)
提交回复
热议问题