Check04C - String id = store(1, ID); Student s1 = new...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import type.lib.Student; import java.io.PrintStream; import java.util.Scanner; i public class Check04C { private static Scanner input = new Scanner(System.in); public static String store(int index, String value) { System.out.printf("Student%d %s: ", index, value); return input.nextLine(); } public static void main(String[] args) { PrintStream output = System.out; final String NAME = "name"; final String ID = "ID"; String name = store(1, NAME);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: String id = store(1, ID); Student s1 = new Student(id, name); name = store(2, NAME); id = store(2, ID); Student s2 = new Student(id, name); output.println("s1.toString yields . .... " + s1.toString()); output.println("s2.toString yields . .... " + s2.toString()); output.println("s1 == s2 yields . ....... " + String.valueOf(s1 == s2)); output.println("s1.equals(s2) yields . .. " + s1.equals(s2)); } }...
View Full Document

This note was uploaded on 09/16/2011 for the course CSE CSE 1020 taught by Professor Burton,ma during the Fall '10 term at York University.

Ask a homework question - tutors are online