{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch03Sections1-5

# ch03Sections1-5 - 3.19 Exercises Problems and Projects...

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

3.19 Exercises, Problems and Projects 3.19.1 Multiple Choice Exercises 1. import 2. true 3. true 4. new 5. false 6. a class method 7. it is a class method 8. Quiz.foo( ); 9. 3 10. double 11. false 12. Char 13. Math.E; 3.19.2 Reading and Understanding Code 14. HI 15. ABCDEFGHIJ 16. hello 17. 5 18. 2.0 19. 3.141592653589793 20. 6 21. 4 22. 8 23. 8.0 3.19.3 Fill in the Code 24. System.out.println( s1 + s2 + s3 ); 25. System.out.println( s.length( ) ); 26. // code below assumes we have imported Scanner Scanner scan = new Scanner( System.in ); System.out.print( "Enter a word > " ); String word = scan.next( ); System.out.println( "You entered " + word ); System.out.println( word + " contains " + word.length( ) + " characters" ); 27. System.out.println( s1 + s2 + s3 + s4 ); 28. System.out.print( "Welcome " ); System.out.print( "to " ); System.out.print( "Java " ); System.out.print( "Illuminated" ); AF_CH03 Page 1

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

View Full Document
29. int max = Math.max( 3, 5 ); System.out.println( "The max of 3 and 5 is " + max ); 30. double sqRoot = Math.sqrt( d ); System.out.println( "The square root of " + d + " is " + sqRoot ); 31. // code below assumes we have imported Scanner Scanner scan = new Scanner( System.in ); System.out.print( "Enter two integers > " ); int i = scan.nextInt( );
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern