{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Program #7 class file

Program #7 class file - else System.out.println"The...

Info icon This 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")
Image of page 1

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

View Full Document Right Arrow Icon
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern