IntegerObjectsAndTheOprNew

IntegerObjectsAndTheOprNew - if (num3.equals(num4)) //Line...

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

8 public class IntegerObjectsAndTheOprNew { public static void main(String[] args) { Integer num1 = 25; //Line 1 Integer num2 = 25; //Line 2 Integer num3 = new Integer(25); //Line 3 Integer num4 = new Integer(25); //Line 4 if (num1 == num2) //Line 5 System.out.println("Line 6: Both num1 and " + "num2 point to the " + "same Integer object."); //Line 6 else //Line 7 System.out.println("Line 8: num1 and num2 " + "do not point to the " + "same Integer object."); //Line 8 if (num1.equals(num2)) //Line 9 System.out.println("Line 9: The values of " + "the Integer objects " + "num1 and num2 point\n" + " to are the " + "same."); //Line 10 else //Line 11 System.out.println("Line 8: The values of " + "the Integer objects " + "num1 and num2 point\n" + " to are not " + "the same."); //Line 12 if (num3 == num4) //Line 13 System.out.println("Line 14: Both num3 and " + "num4 points to the " + "same Integer object."); //Line 14 else //Line 15 System.out.println("Line 16: num3 and num4 " + "do not point to the " + "same Integer object."); //Line 16

This preview has intentionally 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: if (num3.equals(num4)) //Line 17 System.out.println(&quot;Line 18: The values of &quot; + &quot;the Integer objects &quot; + &quot;num3 and num4 point\n&quot; + &quot; to are the &quot; + &quot;same.&quot;); //Line 18 else //Line 19 System.out.println(&quot;Line 20: The values of &quot; + &quot;the Integer objects &quot; + &quot;num3 and num4 point\n&quot; + &quot; to are not &quot; + &quot;the same.&quot;); //Line 20 if (num1 == num3) //Line 21 System.out.println(&quot;Line 22: Both num1 and &quot; + &quot;num3 points to the &quot; + &quot;same Integer object.&quot;); //Line 22 else //Line 23 System.out.println(&quot;Line 24: num1 and num3 &quot; + &quot;do not point to the &quot; + &quot;same Integer object.&quot;); //Line 24 if (num1.equals(num3)) //Line 25 System.out.println(&quot;Line 26: The values of &quot; + &quot;the Integer objects &quot; + &quot;num1 and num3 point\n&quot; + &quot; to are the &quot; + &quot;same.&quot;); //Line 26 else //Line 27 System.out.println(&quot;Line 28: The values of &quot; + &quot;the Integer objects &quot; + &quot;num1 and num3 point\n&quot; + &quot; to are not&quot; + &quot;the same.&quot;); //Line 28 } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Page1 / 2

IntegerObjectsAndTheOprNew - if (num3.equals(num4)) //Line...

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

View Full Document
Ask a homework question - tutors are online