public static void main(String args[]) {
double []temperatures;
int numstudents[] = new int[5];
boolean hungry[] = new boolean[10];
char []grades = new char[3];
String names[] = new String[8];
// Retrieve second value
System.out.println("String:" + names[1]);
// Retrieve second value
System.out.println("char:" + grades[1]);
// Retrieve second value
System.out.println("boolean:" + hungry[1]);
// Retrieve second value
System.out.println("int:" + numstudents[1]);
// Allocate space to store 7 double values
temperatures = new double[7];
// Retrieve second value
System.out.println(temperatures[1]);
} //end main
Showing posts with label Arrays. Show all posts
Showing posts with label Arrays. Show all posts
Friday, December 01, 2006
Demo Default Values of Primitive + Object
Subscribe to:
Posts (Atom)