oop0 - // oop0.java DIS 2/14/2000 // see also oop1.java for...

Download Document
Showing page : 1 of 1
This preview has blurred sections. Sign up to view the full version! View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // oop0.java DIS 2/14/2000 // see also oop1.java 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 a; // Create 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$ a.id = 123456; // Assign a string to the $name$ fiel...