{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

DoubleClassExample

DoubleClassExample - /Line 9 S System.out.println"Line...

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

View Full Document Right Arrow Icon
//Program illustrating autoboxing and unboxing //of Double objects. / public class DoubleClassExample { public static void main(String[] args) { double x, y; //Line 1 Double num1, num2; //Line 2 num1 = 8.5; //Autobox 8.5 //Line 3 num2 = 17.0; //Autobox 17.0 //LIne 4 n System.out.println("Line 5: num1 = " + num1 + ", num2 = " + num2); //Line 5 x = num1 + 4; //Unbox num1, add 4, and //Line 6 //store the result in x; System.out.println("Line 7: x = " + x); //Line 7 S y = num1 + num2; //Unbox num1, num2, add //Line 8 //the values and store //the result in y System.out.println("Line 9: y = " + y);
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //Line 9 S System.out.println("Line 10: The value of " + "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

{[ 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