OnJava8-Examples/housekeeping/InitialValues.java

47 lines
1.1 KiB
Java
Raw Normal View History

2015-06-15 17:47:35 -07:00
//: housekeeping/InitialValues.java
// <20>2015 MindView LLC: see Copyright.txt
// Shows default initial values.
import static com.mindviewinc.util.Print.*;
public class InitialValues {
boolean t;
char c;
byte b;
short s;
int i;
long l;
float f;
double d;
InitialValues reference;
void printInitialValues() {
print("Data type Initial value");
print("boolean " + t);
print("char [" + c + "]");
print("byte " + b);
print("short " + s);
print("int " + i);
print("long " + l);
print("float " + f);
print("double " + d);
print("reference " + reference);
}
public static void main(String[] args) {
InitialValues iv = new InitialValues();
iv.printInitialValues();
/* You could also say:
new InitialValues().printInitialValues();
*/
}
} /* Output:
Data type Initial value
boolean false
char [NUL]
byte 0
short 0
int 0
long 0
float 0.0
double 0.0
reference null
*///:~