May 30, 2008

Chapter: Everything is an Object

Exercise 3: (1) Find the code fragments involving ATypeName and turn them into a program that compiles and runs.


Not exactly sure what they're looking for here, but here's a simple program in Java:
public class Exercise3 {
public static void main(String[] args) {
ATypeName x = new ATypeName();
System.out.println(x.i);
}
}

class ATypeName {
int i = 5;
}

0 comments: