Program #7 class file

Program #7 class file - } else {...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // Matt Hergenrether // Section 012 // CS 1113 // April 14, 2008 // Program 7 // prints everything out import java.util.* public class Class { public static void main(String[] args) { Student stu1, stu2, stu3, stu4 stu1 = new Student("Smith", 123456789, 4.00, "Freshman") stu2 = new Student("Smith", 123456789, 4.00, "Freshman") System.out.println("stu1. ..") System.out.println(stu1) System.out.println("stu2. ..") System.out.println(stu2) // stu1 did not equal stu2 because the == operator refers to the location, "mailbox", // not whether they contain the same data. if(stu1 == stu2) { System.out.println("The results of comparing stu1 to stu2 using == is: true") } else { System.out.println("The results of comparing stu1 to stu2 using == is: false") } if(stu1.equals(stu2)) { System.out.println("The results of comparing stu1 to stu2 using the.equals method is: true")
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } else { System.out.println("The results of comparing stu1 to stu2 using the.equals method is: false") } stu3 = new Student("Doe", 987654321, 3.2534, "Junior") System.out.println("stu3. ..") System.out.println(stu3) Sheet1 Page 2 System.out.println(" Set stu4 = stu3") stu4 = stu3 System.out.println("stu3. ..") System.out.println(stu3) System.out.println("stu4. ..") System.out.println(stu4) System.out.println("Reset stu4.setgpa(3.501)") stu4.setGPA(3.501) System.out.println("stu3. ..") System.out.println(stu3) // The Gpa of student 3 has been changed because the mutator method setgpa changed it System.out.println("stu4. ..") System.out.println(stu4) } }...
View Full Document

Page1 / 2

Program #7 class file - } else {...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online