Engineering‎ > ‎Software‎ > ‎

Java

Java Array Constant Initializer:
These are valid:
    int [] aa = new int[]{1, 2, 4};
    int [] ab = {1, 2, 4};
    int [] ac; ac = new int[]{1, 2, 4};
    return new int[]{1, 2, 4};
This is invalid:
    int [] ac; ac = {1, 2, 4}; // Error: Array constants can only be used in initializers

Java Default Constructor:
Java provides a default no-argument constructor if and only if no constructor had been manually defined. If at least one constructor was defined, no default no-argument constructor is created.
Comments