lec04 - Lecture 4 Manipulating strings Screen output The...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CS125 Course Notes Lecture 4, Slide 1 Lecture 4 • Manipulating strings • Screen output • The Scanner class • (Savitch 2.3)
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 4, Slide 2 String processing • You can’t change the value of a String object but you can change the value of a String variable. • Follow same process used for primitives. • Example: String name = "Joseph"; name = "Alfred"; The value of name is now "Alfred".
Background image of page 2
CS125 Course Notes Lecture 4, Slide 3 Escape characters • Used to input special characters into strings. Example: String greeting = "\"Hi\" is a greeting."; The value of greeting is: "Hi" is a greeting.
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 4, Slide 4 Escape characters continued • All the escape characters are: \" Double quote \' Single quote \\ Backslash \n New line \r Carriage return \t Tab
Background image of page 4
CS125 Course Notes Lecture 4, Slide 5 Screen output System.out.println( output ) the subsequent output will appear on the next line. System.out.print( output ) the subsequent output will appear on the same line immediately following the last character of output .
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 4, Slide 6 Screen output continued
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

lec04 - Lecture 4 Manipulating strings Screen output The...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online