IntegerClassExample

IntegerClassExample - + "2 * num1 + num2 = " + (2...

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

View Full Document Right Arrow Icon
//Program illustrating autoboxing and unboxing //of Integer objects. / public class IntegerClassExample { public static void main(String[] args) { int x, y; //Line 1 Integer num1, num2; //Line 2 num1 = 8; //Autobox 8 //Line 3 num2 = 16; //Autobox 16 //Line 4 n System.out.println("Line 5: num1 = " + num1 + ", num2 = " + num2); //Line 5 x = num1 + 4; //Line 6 x System.out.println("Line 7: x = " + x); //Line 7 S y = num1 + num2; //Line 8 y System.out.println("Line 9: y = " + y); //Line 9 S System.out.println("Line 10: The value of "
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + "2 * num1 + num2 = " + (2 * num1 + num2)); //Line 10 System.out.println("Line 11: The value of " + "x * num2 - num1 = " + (x * num2 - num1)); //Line 11 System.out.println("Line 12: The value of " + "num1 <= num2 is " + (num1 <= num2)); //Line 12 System.out.println("Line 13: The value of " + "2 * num1 <= x is " + (2 * num1 <= x)); //Line 13 System.out.println("Line 14: The value of " + "2 * num1 > num2 is " + (2 * num1 >= num2)); //Line 14 } }...
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.

Ask a homework question - tutors are online