This preview has intentionally blurred parts. Sign up to view the full document

View Full Document

Unformatted Document Excerpt // DIS 2/14/2000 // see also for more explanation //------------------------------------------------------------------------- // CLASS STUDENT //------------------------------------------------------------------------- class Student { int id; String name; } //------------------------------------------------------------------------- // CLASS OOP0 (contains main) //------------------------------------------------------------------------- public class oop0 { public static void main(String[] args) { // Declare a reference variable of class $Student$. Student Create a; // a new object and assign the reference to $a$ a = new Student(); System.out.println("(1) Reference $a$: " + a); System.out.println("(2) Reference w/o assignment: " + (new Student()) ); // Assign an integer to the $id$ field of the object referred to by $a$ = 123456; // Assign a string to the $name$ f...


End of Preview

Sign up now to access the rest of the document