{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Chap03 EX Solutions

Chap03 EX Solutions - Java Software Solutions 6th Edition...

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

View Full Document Right Arrow Icon
Java Software Solutions, 6 th Edition Exercise Solutions, Ch. 3 Chapter 3 Exercise Solutions EX 3.1. Write a statement that prints the number of characters in a String object called overview . System.out.println (overview.length()); EX 3.2. Write a statement that prints the 8 th character of a String object called introduction . System.out.println (introduction.charAt(7)); EX 3.3. Write a declaration for a String variable called change and initialize it to the characters stored in another String object called original with all 'e' characters changed to 'j' . String change = original.replace ('e', 'j'); EX 3.4. What output is produced by the following code fragment? String m1, m2, m3; m1 = "Quest for the Holy Grail"; m2 = m1.toLowerCase(); m3 = m1 + " " + m2; System.out.println (m3.replace('h', 'z')); The output produced is: Quest for tze Holy Grail quest for tze zoly grail The original string is concatenated with a lowercase version of itself, then all lowercase ‘h’ characters are replaced with ‘z’.
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.

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