Professional Documents
Culture Documents
CH07 Characters, Strings and StringBuilder
CH07 Characters, Strings and StringBuilder
Fifth Edition
Chapter 7
Characters, Strings, and the StringBuilder
Objectives
• Literal string
– Sequence of characters enclosed within double quot
ation marks
– Unnamed object, or anonymous object of String cl
ass
• String variable
– Named object of String class
• Class String
– Defined in java.lang.String
– Automatically imported into every program
• String is a class
– Each created String is a class object
• String variable name
– Reference variable
– Refers to location in memory
• Rather than to particular value
• Assign new value to String
– Address held by String altered
• Integer class
– Part of java.lang
– Automatically imported into programs
– Convert String to integer
– parseInt() method
• Takes String argument
• Returns its integer value
• Wrapper
– Class or object “wrapped around” simpler element