// defaults.java // what are the default values of different types of instance variables? class Stuff { char c; int i; float f; double d; boolean b; Object o; String s; } public class defaults { public static void main(String[] args) { Stuff x = new Stuff(); System.out.println("Char: "+x.c); System.out.println("Int: "+x.i); System.out.println("Float: "+x.f); System.out.println("Double: "+x.d); System.out.println("Boolean: "+x.b); System.out.println("Object: "+x.o); System.out.println("String: "+x.s); } } /* output: Char: // NUL ASCII character (character whose code is 0) Int: 0 Float: 0.0 Double: 0.0 Boolean: false // $false$ corresponds to 0 in many languages Object: null // all OBJECTS have default of $null$ (which is an address) String: null // yes, Java considers $String$s as OBJECTS! */