java long初始化_Java变量的初始化

Java变量默认值

Java变量的初始化,如果不赋值,将会有个默认值,对于基本类型,比如int,long是0, boolean 是false等,引用类型如果不设置,将会是null.

package variable.initialize;

public class Test {

int intAge;

short shortAge;

long longAge;

float floatAge;

double doubleAge;

char charC;

boolean booleanFlg;

byte byteB;

String string;

private void print() {

System.out.println("The default value for int is " + intAge);

System.out.println("The default value for short is " + shortAge);

System.out.println("The default value for long is " + longAge);

System.out.println("The default value for float is " + floatAge);

System.out.println("The default value for double is " + doubleAge);

System.out.println("The default value for char is " + charC&

你可能感兴趣的:(java,long初始化)