Thinking in Java Fourth Edition Bruce Eckel Chapter 1 Exercise 1

Exercise 1:  (2) Create a class containing an int and a char that are not initialized, and print their values to verify that Java performs default initialization.


public class PrimitiveTest
static int i;
static char c;
public static void main(String[] args)
System.out.println("int = " + i);
System.out.println("char = " + c);


Leave a Reply

Your email address will not be published. Required fields are marked *