SlideShare a Scribd company logo
1 of 50
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
C HA PT E R 8
Text
Processing
and Wrapper
Classes
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Topics
Introduction to Wrapper Classes
Character Testing and Conversion with the
Character Class
More About String Objects
The StringBuilder Class
Tokenizing Strings
Wrapper Classes for the Numeric Data Types
Focus on Problem Solving: The
TestScoreReader Class
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Introduction to Wrapper
Classes
Java provides 8 primitive data types.
They are called “primitive” because they are not
created from classes.
Java provides wrapper classes for all of the primitive
data types.
A wrapper class is a class that is “wrapped around”
a primitive data type.
The wrapper classes are part of java.lang so to
use them, there is no import statement required.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Wrapper Classes
Wrapper classes allow you to create objects
to represent a primitive.
Wrapper classes are immutable, which
means that once you create an object, you
cannot change the object’s value.
To get the value stored in an object you must
call a method.
Wrapper classes provide static methods that
are very useful
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Character Testing and Conversion With
The Character Class
The Character class allows a char
data type to be wrapped in an object.
The Character class provides
methods that allow easy testing,
processing, and conversion of
character data.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The Character Class
Method Description
boolean isDigit(char ch)
Returns true if the argument passed into ch is
a digit from 0 through 9. Otherwise returns
false.
boolean isLetter(char ch)
Returns true if the argument passed into ch is
an alphabetic letter. Otherwise returns false.
Boolean isLetterOrDigit(char
ch)
Returns true if the character passed into ch
contains a digit (0 through 9) or an alphabetic
letter. Otherwise returns false.
boolean isLowerCase(char ch)
Returns true if the argument passed into ch is
a lowercase letter. Otherwise returns false.
boolean isUpperCase(char ch)
Returns true if the argument passed into ch is
an uppercase letter. Otherwise returns false.
boolean isSpaceChar(char ch)
Returns true if the argument passed into ch is
a space character. Otherwise returns false.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Character Testing and Conversion With
The Character Class
Example:
CharacterTest.java
CustomerNumber.java
The Character class provides two methods
that will change the case of a character.
Method Description
char toLowerCase(
char ch)
Returns the lowercase equivalent of the
argument passed to ch.
char toUpperCase(
char ch)
Returns the uppercase equivalent of the
argument passed to ch.
See example: CircleArea.java
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Substrings
The String class provides several methods
that search for a string inside of a string.
A substring is a string that is part of another
string.
Some of the substring searching methods
provided by the String class:
boolean startsWith(String str)
boolean endsWith(String str)
boolean regionMatches(int start, String str, int start2,
int n)
boolean regionMatches(boolean ignoreCase, int start,
String str, int start2, int n)
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Searching Strings
The startsWith method determines
whether a string begins with a specified
substring.
String str = "Four score and seven years ago";
if (str.startsWith("Four"))
System.out.println("The string starts with Four.");
else
System.out.println("The string does not start with Four.");
str.startsWith("Four") returns true because str
does begin with “Four”.
startsWith is a case sensitive comparison.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Searching Strings
The endsWith method determines
whether a string ends with a specified
substring.
String str = "Four score and seven years ago";
if (str.endsWith("ago"))
System.out.println("The string ends with ago.");
else
System.out.println("The string does not end with ago.");
The endsWith method also performs a
case sensitive comparison.
Example: PersonSearch.java
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Searching Strings
The String class provides methods that determine if
specified regions of two strings match.
regionMatches(int start, String str,
int start2, int n)
returns true if the specified regions match or false if
they don’t
Case sensitive comparison
regionMatches(boolean ignoreCase,
int start, String str,
int start2, int n)
If ignoreCase is true, it performs case insensitive
comparison
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Searching Strings
The String class also provides
methods that will locate the position of
a substring.
indexOf
• returns the first location of a substring or character
in the calling String Object.
lastIndexOf
• returns the last location of a substring or character
in the calling String Object.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Searching Strings
String str = "Four score and seven years ago";
int first, last;
first = str.indexOf('r');
last = str.lastIndexOf('r');
System.out.println("The letter r first appears at "
+ "position " + first);
System.out.println("The letter r last appears at "
+ "position " + last);
String str = "and a one and a two and a three";
int position;
System.out.println("The word and appears at the "
+ "following locations.");
position = str.indexOf("and");
while (position != -1)
{
System.out.println(position);
position = str.indexOf("and", position + 1);
}
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
String Methods For Getting Character Or Substring Location
See Table 8-4
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Extracting Substrings
The String class provides methods
to extract substrings in a String
object.
The substring method returns a substring
beginning at a start location and an optional
ending location.
String fullName = "Cynthia Susan Smith";
String lastName = fullName.substring(14);
System.out.println("The full name is "
+ fullName);
System.out.println("The last name is "
+ lastName);
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Extracting Substrings
Address “Cynthia Susan Smith”
The fullName variable holds
the address of a String object.
Address “Smith”
The lastName variable holds
the address of a String object.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Extracting Characters to
Arrays
The String class provides methods to
extract substrings in a String object
and store them in char arrays.
getChars
Stores a substring in a char array
toCharArray
Returns the String object’s contents in an array
of char values.
Example: StringAnalyzer.java
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Returning Modified Strings
The String class provides methods to
return modified String objects.
concat
Returns a String object that is the concatenation
of two String objects.
replace
Returns a String object with all occurrences of
one character being replaced by another
character.
trim
Returns a String object with all leading and
trailing whitespace characters removed.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The valueOf Methods
The String class provides several
overloaded valueOf methods.
They return a String object representation
of
a primitive value or
a character array.
String.valueOf(true) will return "true".
String.valueOf(5.0) will return "5.0".
String.valueOf(‘C’) will return "C".
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The valueOf Methods
boolean b = true;
char [] letters = { 'a', 'b', 'c', 'd', 'e' };
double d = 2.4981567;
int i = 7;
System.out.println(String.valueOf(b));
System.out.println(String.valueOf(letters));
System.out.println(String.valueOf(letters, 1, 3));
System.out.println(String.valueOf(d));
System.out.println(String.valueOf(i));
Produces the following output:
true
abcde
bcd
2.4981567
7
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The StringBuilder Class
The StringBuilder class is similar to the
String class.
However, you may change the contents of
StringBuilder objects.
You can change specific characters,
insert characters,
delete characters, and
perform other operations.
A StringBuilder object will grow or shrink
in size, as needed, to accommodate the
changes.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
StringBuilder Constructors
StringBuilder()
This constructor gives the object enough storage space
to hold 16 characters.
StringBuilder(int length)
This constructor gives the object enough storage space
to hold length characters.
StringBuilder(String str)
This constructor initializes the object with the string in
str.
The object will have at least enough storage space to
hold the string in str.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Other StringBuilder Methods
The String and StringBuilder also
have common methods:
char charAt(int position)
void getChars(int start, int end,
char[] array, int arrayStart)
int indexOf(String str)
int indexOf(String str, int start)
int lastIndexOf(String str)
int lastIndexOf(String str, int start)
int length()
String substring(int start)
String substring(int start, int end)
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Appending to a StringBuilder Object
The StringBuilder class has several overloaded
versions of a method named append.
They append a string representation of their
argument to the calling object’s current contents.
The general form of the append method is:
object.append(item);
where object is an instance of the
StringBuilder class and item is:
a primitive literal or variable.
a char array, or
a String literal or object.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Appending to a StringBuilder Object
After the append method is called, a string
representation of item will be appended to object’s
contents.
StringBuilder str = new StringBuilder();
str.append("We sold ");
str.append(12);
str.append(" doughnuts for $");
str.append(15.95);
System.out.println(str);
This code will produce the following output:
We sold 12 doughnuts for $15.95
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Appending to a StringBuilder Object
The StringBuilder class also has several
overloaded versions of a method named
insert
These methods accept two arguments:
an int that specifies the position to begin
insertion, and
the value to be inserted.
The value to be inserted may be
a primitive literal or variable.
a char array, or
a String literal or object.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The general form of a typical call to the insert
method.
object.insert(start, item);
where object is an instance of the
StringBuilder class, start is the insertion
location, and item is:
a primitive literal or variable.
a char array, or
a String literal or object.
Example:
Telephone.java
TelephoneTester.java
Appending to a StringBuilder Object
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The StringBuilder class has a replace method
that replaces a specified substring with a string.
The general form of a call to the method:
object.replace(start, end, str);
start is an int that specifies the starting position
of a substring in the calling object, and
end is an int that specifies the ending position of
the substring. (The starting position is included in
the substring, but the ending position is not.)
The str parameter is a String object.
After the method executes, the substring will be
replaced with str.
Replacing a Substring in a StringBuilder
Object
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The replace method in this code
replaces the word “Chicago” with “New
York”.
StringBuilder str = new StringBuilder(
"We moved from Chicago to Atlanta.");
str.replace(14, 21, "New York");
System.out.println(str);
The code will produce the following
output:
We moved from New York to Atlanta.
Replacing a Substring in a StringBuilder
Object
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Other StringBuilder Methods
The StringBuilder class also provides methods to
set and delete characters in an object.
StringBuilder str = new StringBuilder(
"I ate 100 blueberries!");
// Display the StringBuilder object.
System.out.println(str);
// Delete the '0'.
str.deleteCharAt(8);
// Delete "blue".
str.delete(9, 13);
// Display the StringBuilder object.
System.out.println(str);
// Change the '1' to '5'
str.setCharAt(6, '5');
// Display the StringBuilder object.
System.out.println(str);
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The StringTokenizer Class
The StringTokenizer class breaks a string
down into its components, which are called
tokens.
Tokens are a series of words or other items
of data separated by spaces or other
characters.
"peach raspberry strawberry vanilla"
This string contains the following four
tokens: peach, raspberry, strawberry, and
vanilla.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The StringTokenizer Class
The character that separates tokens is a
delimiter.
"17;92;81;12;46;5"
This string contains the following
tokens: 17, 92, 81, 12, 46, and 5 that are
delimited by semi-colons.
Some programming problems require
you to process a string that contains a
list of items.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The StringTokenizer Class
For example,
The process of breaking a string into
tokens is known as tokenizing.
The Java API provides the
StringTokenizer class that allows you
to tokenize a string.
The following import statement must be
used in any class that uses it:
import java.util.StringTokenizer;
•a date:
•"11-22-2007"
•an operating system
pathname,
•/home/rsullivan/data
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
StringTokenizer Constructors
Constructor Description
StringTokenizer(
String str)
The string to be tokenized is passed into
str. Whitespace characters (space, tab, and
newline) are used as delimiters.
StringTokenizer(
String str,
String delimiters)
The string to be tokenized is passed into
str. The characters in delimiters will be used
as delimiters.
StringTokenizer(
String str,
String delimiters,
Boolean returnDelimeters)
The string to be tokenized is passed into
str. The characters in delimiters will be used
as delimiters. If the returnDelimiters
parameter is set to true, the delimiters will
be included as tokens. If this parameter is
set to false, the delimiters will not be
included as tokens.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Creating StringTokenizer Objects
To create a StringTokenizer object with the
default delimiters (whitespace characters):
StringTokenizer strTokenizer =
new StringTokenizer("2 4 6 8");
To create a StringTokenizer object with the
hyphen character as a delimiter:
StringTokenizer strTokenizer =
new StringTokenizer("8-14-2004", "-");
To create a StringTokenizer object with the
hyphen character as a delimiter, returning hyphen
characters as tokens as well:
StringTokenizer strTokenizer =
new StringTokenizer("8-14-2004", "-", true);
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
StringTokenizer Methods
The StringTokenizer class provides:
countTokens
Count the remaining tokens in the string.
hasMoreTokens
Are there any more tokens to extract?
nextToken
Returns the next token in the string.
Throws a NoSuchElementException if there
are no more tokens in the string.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Extracting Tokens
Loops are often used to extract tokens from a string.
StringTokenizer strTokenizer =
new StringTokenizer("One Two Three");
while (strTokenizer.hasMoreTokens())
{
System.out.println(strTokenizer.nextToken());
}
This code will produce the following output:
One
Two
Three
Examples: DateComponent.java, DateTester.java
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Multiple Delimiters
The default delimiters for the StringTokenizer
class are the whitespace characters.
nrtbf
Other multiple characters can be used as delimiters in
the same string.
joe@gaddisbooks.com
This string uses two delimiters: @ and .
If non-default delimiters are used
The String class trim method should be used on
user input strings to avoid having whitespace become
part of the last token.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Multiple Delimiters
To extract the tokens from this string we must
specify both characters as delimiters to the
constructor.
StringTokenizer strTokenizer =
new StringTokenizer("joe@gaddisbooks.com", "@.");
while (strTokenizer.hasMoreTokens())
{
System.out.println(strTokenizer.nextToken());
}
This code will produce the following output:
joe
gaddisbooks
com
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The String Class split Method
Tokenizes a String object and returns an array of
String objects
Each array element is one token.
// Create a String to tokenize.
String str = "one two three four";
// Get the tokens from the string.
String[] tokens = str.split(" ");
// Display each token.
for (String s : tokens)
System.out.println(s);
This code will produce the following output:
one
two
three
four
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Numeric Data Type Wrappers
Java provides wrapper classes for all of the primitive
data types.
The numeric primitive wrapper classes are:
Wrapper
Class
Numeric Primitive
Type It Applies To
Byte byte
Double double
Float float
Integer int
Long long
Short short
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Creating a Wrapper Object
To create objects from these wrapper
classes, you can pass a value to the
constructor:
Integer number = new Integer(7);
You can also assign a primitive value
to a wrapper class object:
Integer number;
number = 7;
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The Parse Methods
A string containing a number, such as “127.89, can be
converted to a numeric data type.
Each of the numeric wrapper classes has a static
method that converts a string to a number.
The Integer class has a method that converts a
String to an int,
The Double class has a method that converts a
String to a double,
etc.
These methods are known as parse methods because
their names begin with the word “parse.”
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The Parse Methods
// Store 1 in bVar.
byte bVar = Byte.parseByte("1");
// Store 2599 in iVar.
int iVar = Integer.parseInt("2599");
// Store 10 in sVar.
short sVar = Short.parseShort("10");
// Store 15908 in lVar.
long lVar = Long.parseLong("15908");
// Store 12.3 in fVar.
float fVar = Float.parseFloat("12.3");
// Store 7945.6 in dVar.
double dVar = Double.parseDouble("7945.6");
The parse methods all throw a
NumberFormatException if the String object does
not represent a numeric value.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The toString Methods
Each of the numeric wrapper classes
has a static toString method that
converts a number to a string.
The method accepts the number as its
argument and returns a string
representation of that number.
int i = 12;
double d = 14.95;
String str1 = Integer.toString(i);
String str2 = Double.toString(d);
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The toBinaryString, toHexString, and
toOctalString Methods
The Integer and Long classes have
three additional methods:
toBinaryString, toHexString, and
toOctalString
int number = 14;
System.out.println(Integer.toBinaryString(number));
System.out.println(Integer.toHexString(number));
System.out.println(Integer.toOctalString(number));
This code will produce the following output:
1110
e
16
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
MIN_VALUE and MAX_VALUE
The numeric wrapper classes each have a
set of static final variables
MIN_VALUE and
MAX_VALUE.
These variables hold the minimum and
maximum values for a particular data type.
System.out.println("The minimum value for an "
+ "int is "
+ Integer.MIN_VALUE);
System.out.println("The maximum value for an "
+ "int is "
+ Integer.MAX_VALUE);
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Autoboxing and Unboxing
You can declare a wrapper class variable and
assign a value:
Integer number;
number = 7;
You nay think this is an error, but because
number is a wrapper class variable,
autoboxing occurs.
Unboxing does the opposite with wrapper
class variables:
Integer myInt = 5; // Autoboxes the value 5
int primitiveNumber;
primitiveNumber = myInt; // unboxing
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Autoboxing and Unboxing
You rarely need to declare numeric wrapper
class objects, but they can be useful when
you need to work with primitives in a context
where primitives are not permitted
Recall the ArrayList class, which works only
with objects.
ArrayList<int> list =
new ArrayList<int>(); // Error!
ArrayList<Integer> list =
new ArrayList<Integer>(); // OK!
Autoboxing and unboxing allow you to
conveniently use ArrayLists with primitives.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Problem Solving Example:
The TestScoreReader Class
Dr. Harrison keeps student scores in an Excel file.
This can be exported as a comma separated text file.
Each student’s data will be on one line.
We want to write a Java program that will find the
average for each student. (The number of students
changes each year.)
Solution: TestScoreReader.java, TestAverages.java

More Related Content

What's hot

Ap Power Point Chpt2
Ap Power Point Chpt2Ap Power Point Chpt2
Ap Power Point Chpt2dplunkett
 
Upstate CSCI 200 Java Chapter 8 - Arrays
Upstate CSCI 200 Java Chapter 8 - ArraysUpstate CSCI 200 Java Chapter 8 - Arrays
Upstate CSCI 200 Java Chapter 8 - ArraysDanWooster1
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsİbrahim Kürce
 
Cso gaddis java_chapter13
Cso gaddis java_chapter13Cso gaddis java_chapter13
Cso gaddis java_chapter13mlrbrown
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variablesRavi_Kant_Sahu
 
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5eEo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5eGina Bullock
 
Cso gaddis java_chapter9ppt
Cso gaddis java_chapter9pptCso gaddis java_chapter9ppt
Cso gaddis java_chapter9pptmlrbrown
 
Eo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5eEo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5eGina Bullock
 

What's hot (18)

Chap6java5th
Chap6java5thChap6java5th
Chap6java5th
 
Chap4java5th
Chap4java5thChap4java5th
Chap4java5th
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
List classes
List classesList classes
List classes
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
Ap Power Point Chpt2
Ap Power Point Chpt2Ap Power Point Chpt2
Ap Power Point Chpt2
 
Upstate CSCI 200 Java Chapter 8 - Arrays
Upstate CSCI 200 Java Chapter 8 - ArraysUpstate CSCI 200 Java Chapter 8 - Arrays
Upstate CSCI 200 Java Chapter 8 - Arrays
 
Overview of Java
Overview of Java Overview of Java
Overview of Java
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
 
Cso gaddis java_chapter13
Cso gaddis java_chapter13Cso gaddis java_chapter13
Cso gaddis java_chapter13
 
Array
ArrayArray
Array
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variables
 
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5eEo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
 
PCSTt11 overview of java
PCSTt11 overview of javaPCSTt11 overview of java
PCSTt11 overview of java
 
Classes2
Classes2Classes2
Classes2
 
Cso gaddis java_chapter9ppt
Cso gaddis java_chapter9pptCso gaddis java_chapter9ppt
Cso gaddis java_chapter9ppt
 
Chap2java5th
Chap2java5thChap2java5th
Chap2java5th
 
Eo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5eEo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5e
 

Viewers also liked

0803899129 3006073 31402269_d
0803899129 3006073 31402269_d0803899129 3006073 31402269_d
0803899129 3006073 31402269_dalvaro zuñiga
 
Film Production Risk Assessment
Film Production Risk AssessmentFilm Production Risk Assessment
Film Production Risk AssessmentDeclan556
 
Puerto Rico: Economic Perception vs. Reality
Puerto Rico: Economic Perception vs. RealityPuerto Rico: Economic Perception vs. Reality
Puerto Rico: Economic Perception vs. RealityJLL
 
Motion Graphics Storyboards
Motion Graphics StoryboardsMotion Graphics Storyboards
Motion Graphics StoryboardsDeclan556
 
Stone coated metal roof tile catalogue
Stone coated metal roof tile catalogueStone coated metal roof tile catalogue
Stone coated metal roof tile catalogueAllen Humphrey
 
Warren Frehse article - Geelong Advertiser 8 Nov 08
Warren Frehse article - Geelong Advertiser 8 Nov 08Warren Frehse article - Geelong Advertiser 8 Nov 08
Warren Frehse article - Geelong Advertiser 8 Nov 08Warren Frehse
 
Funcionamiento de navegadores y servidores web
Funcionamiento de navegadores y servidores webFuncionamiento de navegadores y servidores web
Funcionamiento de navegadores y servidores webJosé Quintana Moreno
 
Essay-LeNae Pastoral Care Sept 2015
Essay-LeNae Pastoral Care Sept 2015Essay-LeNae Pastoral Care Sept 2015
Essay-LeNae Pastoral Care Sept 2015LeNae Onstad
 
Nobel Discoveries in Immunology (1901-Till date)
Nobel Discoveries in Immunology (1901-Till date)Nobel Discoveries in Immunology (1901-Till date)
Nobel Discoveries in Immunology (1901-Till date)Madhukar Vedantham
 
Milestone Selling: Proactive Pipeline Leadership
Milestone Selling: Proactive Pipeline LeadershipMilestone Selling: Proactive Pipeline Leadership
Milestone Selling: Proactive Pipeline LeadershipDoble Group, LLC
 
9 varianta oficiala bac matematica m1 2010 (prima sesiune)
9 varianta oficiala bac matematica m1   2010 (prima sesiune)9 varianta oficiala bac matematica m1   2010 (prima sesiune)
9 varianta oficiala bac matematica m1 2010 (prima sesiune)Gherghescu Gabriel
 
Mapa Conceptual datos información sistema programa
Mapa Conceptual datos información sistema programaMapa Conceptual datos información sistema programa
Mapa Conceptual datos información sistema programaAR Marotta
 

Viewers also liked (14)

0803899129 3006073 31402269_d
0803899129 3006073 31402269_d0803899129 3006073 31402269_d
0803899129 3006073 31402269_d
 
Film Production Risk Assessment
Film Production Risk AssessmentFilm Production Risk Assessment
Film Production Risk Assessment
 
document-17
document-17document-17
document-17
 
Puerto Rico: Economic Perception vs. Reality
Puerto Rico: Economic Perception vs. RealityPuerto Rico: Economic Perception vs. Reality
Puerto Rico: Economic Perception vs. Reality
 
Motion Graphics Storyboards
Motion Graphics StoryboardsMotion Graphics Storyboards
Motion Graphics Storyboards
 
Stone coated metal roof tile catalogue
Stone coated metal roof tile catalogueStone coated metal roof tile catalogue
Stone coated metal roof tile catalogue
 
Warren Frehse article - Geelong Advertiser 8 Nov 08
Warren Frehse article - Geelong Advertiser 8 Nov 08Warren Frehse article - Geelong Advertiser 8 Nov 08
Warren Frehse article - Geelong Advertiser 8 Nov 08
 
Funcionamiento de navegadores y servidores web
Funcionamiento de navegadores y servidores webFuncionamiento de navegadores y servidores web
Funcionamiento de navegadores y servidores web
 
Efruzhu cancer carci̇nogenesi̇s theory 34
Efruzhu cancer carci̇nogenesi̇s theory 34Efruzhu cancer carci̇nogenesi̇s theory 34
Efruzhu cancer carci̇nogenesi̇s theory 34
 
Essay-LeNae Pastoral Care Sept 2015
Essay-LeNae Pastoral Care Sept 2015Essay-LeNae Pastoral Care Sept 2015
Essay-LeNae Pastoral Care Sept 2015
 
Nobel Discoveries in Immunology (1901-Till date)
Nobel Discoveries in Immunology (1901-Till date)Nobel Discoveries in Immunology (1901-Till date)
Nobel Discoveries in Immunology (1901-Till date)
 
Milestone Selling: Proactive Pipeline Leadership
Milestone Selling: Proactive Pipeline LeadershipMilestone Selling: Proactive Pipeline Leadership
Milestone Selling: Proactive Pipeline Leadership
 
9 varianta oficiala bac matematica m1 2010 (prima sesiune)
9 varianta oficiala bac matematica m1   2010 (prima sesiune)9 varianta oficiala bac matematica m1   2010 (prima sesiune)
9 varianta oficiala bac matematica m1 2010 (prima sesiune)
 
Mapa Conceptual datos información sistema programa
Mapa Conceptual datos información sistema programaMapa Conceptual datos información sistema programa
Mapa Conceptual datos información sistema programa
 

Similar to Eo gaddis java_chapter_08_5e

Cso gaddis java_chapter10
Cso gaddis java_chapter10Cso gaddis java_chapter10
Cso gaddis java_chapter10mlrbrown
 
String handling(string class)
String handling(string class)String handling(string class)
String handling(string class)Ravi Kant Sahu
 
String handling(string class)
String handling(string class)String handling(string class)
String handling(string class)Ravi_Kant_Sahu
 
LiangChapter4 Unicode , ASCII Code .ppt
LiangChapter4 Unicode , ASCII Code  .pptLiangChapter4 Unicode , ASCII Code  .ppt
LiangChapter4 Unicode , ASCII Code .pptzainiiqbal761
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9Vince Vo
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and StringsEduardo Bergavera
 
Eo gaddis java_chapter_07_5e
Eo gaddis java_chapter_07_5eEo gaddis java_chapter_07_5e
Eo gaddis java_chapter_07_5eGina Bullock
 
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5eEo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5eGina Bullock
 
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5eEo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5eGina Bullock
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regexwayn
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarationssshhzap
 

Similar to Eo gaddis java_chapter_08_5e (20)

Cso gaddis java_chapter10
Cso gaddis java_chapter10Cso gaddis java_chapter10
Cso gaddis java_chapter10
 
11-ch04-3-strings.pdf
11-ch04-3-strings.pdf11-ch04-3-strings.pdf
11-ch04-3-strings.pdf
 
M C6java7
M C6java7M C6java7
M C6java7
 
String handling(string class)
String handling(string class)String handling(string class)
String handling(string class)
 
String handling(string class)
String handling(string class)String handling(string class)
String handling(string class)
 
LiangChapter4 Unicode , ASCII Code .ppt
LiangChapter4 Unicode , ASCII Code  .pptLiangChapter4 Unicode , ASCII Code  .ppt
LiangChapter4 Unicode , ASCII Code .ppt
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
07slide
07slide07slide
07slide
 
Strings in java
Strings in javaStrings in java
Strings in java
 
Eo gaddis java_chapter_07_5e
Eo gaddis java_chapter_07_5eEo gaddis java_chapter_07_5e
Eo gaddis java_chapter_07_5e
 
easyPy-Basic.pdf
easyPy-Basic.pdfeasyPy-Basic.pdf
easyPy-Basic.pdf
 
Java String Handling
Java String HandlingJava String Handling
Java String Handling
 
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5eEo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
 
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5eEo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regex
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarations
 
Strings.ppt
Strings.pptStrings.ppt
Strings.ppt
 
8. String
8. String8. String
8. String
 
arrays.pptx
arrays.pptxarrays.pptx
arrays.pptx
 

More from Gina Bullock

Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5eEo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5eGina Bullock
 
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eEo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eGina Bullock
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eGina Bullock
 
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eEo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eGina Bullock
 
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5eEo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5eGina Bullock
 
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eEo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eGina Bullock
 
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5eEo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5eGina Bullock
 
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5eEo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5eGina Bullock
 
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5eEo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5eGina Bullock
 
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eEo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eGina Bullock
 
Eo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5eEo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5eGina Bullock
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eGina Bullock
 
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eEo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eGina Bullock
 
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5eEo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5eGina Bullock
 
Eo gaddis java_chapter_02_5e
Eo gaddis java_chapter_02_5eEo gaddis java_chapter_02_5e
Eo gaddis java_chapter_02_5eGina Bullock
 
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5eEo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5eGina Bullock
 
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eEo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eGina Bullock
 

More from Gina Bullock (17)

Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5eEo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5e
 
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eEo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
 
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eEo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
 
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5eEo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5e
 
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eEo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5e
 
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5eEo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5e
 
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5eEo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5e
 
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5eEo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5e
 
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eEo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
 
Eo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5eEo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5e
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
 
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eEo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
 
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5eEo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5e
 
Eo gaddis java_chapter_02_5e
Eo gaddis java_chapter_02_5eEo gaddis java_chapter_02_5e
Eo gaddis java_chapter_02_5e
 
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5eEo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5e
 
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eEo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5e
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 

Eo gaddis java_chapter_08_5e

  • 1. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C HA PT E R 8 Text Processing and Wrapper Classes
  • 2. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Topics Introduction to Wrapper Classes Character Testing and Conversion with the Character Class More About String Objects The StringBuilder Class Tokenizing Strings Wrapper Classes for the Numeric Data Types Focus on Problem Solving: The TestScoreReader Class
  • 3. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Wrapper Classes Java provides 8 primitive data types. They are called “primitive” because they are not created from classes. Java provides wrapper classes for all of the primitive data types. A wrapper class is a class that is “wrapped around” a primitive data type. The wrapper classes are part of java.lang so to use them, there is no import statement required.
  • 4. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Wrapper Classes Wrapper classes allow you to create objects to represent a primitive. Wrapper classes are immutable, which means that once you create an object, you cannot change the object’s value. To get the value stored in an object you must call a method. Wrapper classes provide static methods that are very useful
  • 5. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Character Testing and Conversion With The Character Class The Character class allows a char data type to be wrapped in an object. The Character class provides methods that allow easy testing, processing, and conversion of character data.
  • 6. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Character Class Method Description boolean isDigit(char ch) Returns true if the argument passed into ch is a digit from 0 through 9. Otherwise returns false. boolean isLetter(char ch) Returns true if the argument passed into ch is an alphabetic letter. Otherwise returns false. Boolean isLetterOrDigit(char ch) Returns true if the character passed into ch contains a digit (0 through 9) or an alphabetic letter. Otherwise returns false. boolean isLowerCase(char ch) Returns true if the argument passed into ch is a lowercase letter. Otherwise returns false. boolean isUpperCase(char ch) Returns true if the argument passed into ch is an uppercase letter. Otherwise returns false. boolean isSpaceChar(char ch) Returns true if the argument passed into ch is a space character. Otherwise returns false.
  • 7. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Character Testing and Conversion With The Character Class Example: CharacterTest.java CustomerNumber.java The Character class provides two methods that will change the case of a character. Method Description char toLowerCase( char ch) Returns the lowercase equivalent of the argument passed to ch. char toUpperCase( char ch) Returns the uppercase equivalent of the argument passed to ch. See example: CircleArea.java
  • 8. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Substrings The String class provides several methods that search for a string inside of a string. A substring is a string that is part of another string. Some of the substring searching methods provided by the String class: boolean startsWith(String str) boolean endsWith(String str) boolean regionMatches(int start, String str, int start2, int n) boolean regionMatches(boolean ignoreCase, int start, String str, int start2, int n)
  • 9. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Searching Strings The startsWith method determines whether a string begins with a specified substring. String str = "Four score and seven years ago"; if (str.startsWith("Four")) System.out.println("The string starts with Four."); else System.out.println("The string does not start with Four."); str.startsWith("Four") returns true because str does begin with “Four”. startsWith is a case sensitive comparison.
  • 10. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Searching Strings The endsWith method determines whether a string ends with a specified substring. String str = "Four score and seven years ago"; if (str.endsWith("ago")) System.out.println("The string ends with ago."); else System.out.println("The string does not end with ago."); The endsWith method also performs a case sensitive comparison. Example: PersonSearch.java
  • 11. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Searching Strings The String class provides methods that determine if specified regions of two strings match. regionMatches(int start, String str, int start2, int n) returns true if the specified regions match or false if they don’t Case sensitive comparison regionMatches(boolean ignoreCase, int start, String str, int start2, int n) If ignoreCase is true, it performs case insensitive comparison
  • 12. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Searching Strings The String class also provides methods that will locate the position of a substring. indexOf • returns the first location of a substring or character in the calling String Object. lastIndexOf • returns the last location of a substring or character in the calling String Object.
  • 13. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Searching Strings String str = "Four score and seven years ago"; int first, last; first = str.indexOf('r'); last = str.lastIndexOf('r'); System.out.println("The letter r first appears at " + "position " + first); System.out.println("The letter r last appears at " + "position " + last); String str = "and a one and a two and a three"; int position; System.out.println("The word and appears at the " + "following locations."); position = str.indexOf("and"); while (position != -1) { System.out.println(position); position = str.indexOf("and", position + 1); }
  • 14. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley String Methods For Getting Character Or Substring Location See Table 8-4
  • 15. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extracting Substrings The String class provides methods to extract substrings in a String object. The substring method returns a substring beginning at a start location and an optional ending location. String fullName = "Cynthia Susan Smith"; String lastName = fullName.substring(14); System.out.println("The full name is " + fullName); System.out.println("The last name is " + lastName);
  • 16. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extracting Substrings Address “Cynthia Susan Smith” The fullName variable holds the address of a String object. Address “Smith” The lastName variable holds the address of a String object.
  • 17. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extracting Characters to Arrays The String class provides methods to extract substrings in a String object and store them in char arrays. getChars Stores a substring in a char array toCharArray Returns the String object’s contents in an array of char values. Example: StringAnalyzer.java
  • 18. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Returning Modified Strings The String class provides methods to return modified String objects. concat Returns a String object that is the concatenation of two String objects. replace Returns a String object with all occurrences of one character being replaced by another character. trim Returns a String object with all leading and trailing whitespace characters removed.
  • 19. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The valueOf Methods The String class provides several overloaded valueOf methods. They return a String object representation of a primitive value or a character array. String.valueOf(true) will return "true". String.valueOf(5.0) will return "5.0". String.valueOf(‘C’) will return "C".
  • 20. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The valueOf Methods boolean b = true; char [] letters = { 'a', 'b', 'c', 'd', 'e' }; double d = 2.4981567; int i = 7; System.out.println(String.valueOf(b)); System.out.println(String.valueOf(letters)); System.out.println(String.valueOf(letters, 1, 3)); System.out.println(String.valueOf(d)); System.out.println(String.valueOf(i)); Produces the following output: true abcde bcd 2.4981567 7
  • 21. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The StringBuilder Class The StringBuilder class is similar to the String class. However, you may change the contents of StringBuilder objects. You can change specific characters, insert characters, delete characters, and perform other operations. A StringBuilder object will grow or shrink in size, as needed, to accommodate the changes.
  • 22. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley StringBuilder Constructors StringBuilder() This constructor gives the object enough storage space to hold 16 characters. StringBuilder(int length) This constructor gives the object enough storage space to hold length characters. StringBuilder(String str) This constructor initializes the object with the string in str. The object will have at least enough storage space to hold the string in str.
  • 23. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Other StringBuilder Methods The String and StringBuilder also have common methods: char charAt(int position) void getChars(int start, int end, char[] array, int arrayStart) int indexOf(String str) int indexOf(String str, int start) int lastIndexOf(String str) int lastIndexOf(String str, int start) int length() String substring(int start) String substring(int start, int end)
  • 24. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Appending to a StringBuilder Object The StringBuilder class has several overloaded versions of a method named append. They append a string representation of their argument to the calling object’s current contents. The general form of the append method is: object.append(item); where object is an instance of the StringBuilder class and item is: a primitive literal or variable. a char array, or a String literal or object.
  • 25. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Appending to a StringBuilder Object After the append method is called, a string representation of item will be appended to object’s contents. StringBuilder str = new StringBuilder(); str.append("We sold "); str.append(12); str.append(" doughnuts for $"); str.append(15.95); System.out.println(str); This code will produce the following output: We sold 12 doughnuts for $15.95
  • 26. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Appending to a StringBuilder Object The StringBuilder class also has several overloaded versions of a method named insert These methods accept two arguments: an int that specifies the position to begin insertion, and the value to be inserted. The value to be inserted may be a primitive literal or variable. a char array, or a String literal or object.
  • 27. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The general form of a typical call to the insert method. object.insert(start, item); where object is an instance of the StringBuilder class, start is the insertion location, and item is: a primitive literal or variable. a char array, or a String literal or object. Example: Telephone.java TelephoneTester.java Appending to a StringBuilder Object
  • 28. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The StringBuilder class has a replace method that replaces a specified substring with a string. The general form of a call to the method: object.replace(start, end, str); start is an int that specifies the starting position of a substring in the calling object, and end is an int that specifies the ending position of the substring. (The starting position is included in the substring, but the ending position is not.) The str parameter is a String object. After the method executes, the substring will be replaced with str. Replacing a Substring in a StringBuilder Object
  • 29. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The replace method in this code replaces the word “Chicago” with “New York”. StringBuilder str = new StringBuilder( "We moved from Chicago to Atlanta."); str.replace(14, 21, "New York"); System.out.println(str); The code will produce the following output: We moved from New York to Atlanta. Replacing a Substring in a StringBuilder Object
  • 30. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Other StringBuilder Methods The StringBuilder class also provides methods to set and delete characters in an object. StringBuilder str = new StringBuilder( "I ate 100 blueberries!"); // Display the StringBuilder object. System.out.println(str); // Delete the '0'. str.deleteCharAt(8); // Delete "blue". str.delete(9, 13); // Display the StringBuilder object. System.out.println(str); // Change the '1' to '5' str.setCharAt(6, '5'); // Display the StringBuilder object. System.out.println(str);
  • 31. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The StringTokenizer Class The StringTokenizer class breaks a string down into its components, which are called tokens. Tokens are a series of words or other items of data separated by spaces or other characters. "peach raspberry strawberry vanilla" This string contains the following four tokens: peach, raspberry, strawberry, and vanilla.
  • 32. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The StringTokenizer Class The character that separates tokens is a delimiter. "17;92;81;12;46;5" This string contains the following tokens: 17, 92, 81, 12, 46, and 5 that are delimited by semi-colons. Some programming problems require you to process a string that contains a list of items.
  • 33. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The StringTokenizer Class For example, The process of breaking a string into tokens is known as tokenizing. The Java API provides the StringTokenizer class that allows you to tokenize a string. The following import statement must be used in any class that uses it: import java.util.StringTokenizer; •a date: •"11-22-2007" •an operating system pathname, •/home/rsullivan/data
  • 34. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley StringTokenizer Constructors Constructor Description StringTokenizer( String str) The string to be tokenized is passed into str. Whitespace characters (space, tab, and newline) are used as delimiters. StringTokenizer( String str, String delimiters) The string to be tokenized is passed into str. The characters in delimiters will be used as delimiters. StringTokenizer( String str, String delimiters, Boolean returnDelimeters) The string to be tokenized is passed into str. The characters in delimiters will be used as delimiters. If the returnDelimiters parameter is set to true, the delimiters will be included as tokens. If this parameter is set to false, the delimiters will not be included as tokens.
  • 35. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Creating StringTokenizer Objects To create a StringTokenizer object with the default delimiters (whitespace characters): StringTokenizer strTokenizer = new StringTokenizer("2 4 6 8"); To create a StringTokenizer object with the hyphen character as a delimiter: StringTokenizer strTokenizer = new StringTokenizer("8-14-2004", "-"); To create a StringTokenizer object with the hyphen character as a delimiter, returning hyphen characters as tokens as well: StringTokenizer strTokenizer = new StringTokenizer("8-14-2004", "-", true);
  • 36. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley StringTokenizer Methods The StringTokenizer class provides: countTokens Count the remaining tokens in the string. hasMoreTokens Are there any more tokens to extract? nextToken Returns the next token in the string. Throws a NoSuchElementException if there are no more tokens in the string.
  • 37. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extracting Tokens Loops are often used to extract tokens from a string. StringTokenizer strTokenizer = new StringTokenizer("One Two Three"); while (strTokenizer.hasMoreTokens()) { System.out.println(strTokenizer.nextToken()); } This code will produce the following output: One Two Three Examples: DateComponent.java, DateTester.java
  • 38. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Multiple Delimiters The default delimiters for the StringTokenizer class are the whitespace characters. nrtbf Other multiple characters can be used as delimiters in the same string. joe@gaddisbooks.com This string uses two delimiters: @ and . If non-default delimiters are used The String class trim method should be used on user input strings to avoid having whitespace become part of the last token.
  • 39. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Multiple Delimiters To extract the tokens from this string we must specify both characters as delimiters to the constructor. StringTokenizer strTokenizer = new StringTokenizer("joe@gaddisbooks.com", "@."); while (strTokenizer.hasMoreTokens()) { System.out.println(strTokenizer.nextToken()); } This code will produce the following output: joe gaddisbooks com
  • 40. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The String Class split Method Tokenizes a String object and returns an array of String objects Each array element is one token. // Create a String to tokenize. String str = "one two three four"; // Get the tokens from the string. String[] tokens = str.split(" "); // Display each token. for (String s : tokens) System.out.println(s); This code will produce the following output: one two three four
  • 41. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Numeric Data Type Wrappers Java provides wrapper classes for all of the primitive data types. The numeric primitive wrapper classes are: Wrapper Class Numeric Primitive Type It Applies To Byte byte Double double Float float Integer int Long long Short short
  • 42. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Creating a Wrapper Object To create objects from these wrapper classes, you can pass a value to the constructor: Integer number = new Integer(7); You can also assign a primitive value to a wrapper class object: Integer number; number = 7;
  • 43. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Parse Methods A string containing a number, such as “127.89, can be converted to a numeric data type. Each of the numeric wrapper classes has a static method that converts a string to a number. The Integer class has a method that converts a String to an int, The Double class has a method that converts a String to a double, etc. These methods are known as parse methods because their names begin with the word “parse.”
  • 44. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Parse Methods // Store 1 in bVar. byte bVar = Byte.parseByte("1"); // Store 2599 in iVar. int iVar = Integer.parseInt("2599"); // Store 10 in sVar. short sVar = Short.parseShort("10"); // Store 15908 in lVar. long lVar = Long.parseLong("15908"); // Store 12.3 in fVar. float fVar = Float.parseFloat("12.3"); // Store 7945.6 in dVar. double dVar = Double.parseDouble("7945.6"); The parse methods all throw a NumberFormatException if the String object does not represent a numeric value.
  • 45. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The toString Methods Each of the numeric wrapper classes has a static toString method that converts a number to a string. The method accepts the number as its argument and returns a string representation of that number. int i = 12; double d = 14.95; String str1 = Integer.toString(i); String str2 = Double.toString(d);
  • 46. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The toBinaryString, toHexString, and toOctalString Methods The Integer and Long classes have three additional methods: toBinaryString, toHexString, and toOctalString int number = 14; System.out.println(Integer.toBinaryString(number)); System.out.println(Integer.toHexString(number)); System.out.println(Integer.toOctalString(number)); This code will produce the following output: 1110 e 16
  • 47. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley MIN_VALUE and MAX_VALUE The numeric wrapper classes each have a set of static final variables MIN_VALUE and MAX_VALUE. These variables hold the minimum and maximum values for a particular data type. System.out.println("The minimum value for an " + "int is " + Integer.MIN_VALUE); System.out.println("The maximum value for an " + "int is " + Integer.MAX_VALUE);
  • 48. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Autoboxing and Unboxing You can declare a wrapper class variable and assign a value: Integer number; number = 7; You nay think this is an error, but because number is a wrapper class variable, autoboxing occurs. Unboxing does the opposite with wrapper class variables: Integer myInt = 5; // Autoboxes the value 5 int primitiveNumber; primitiveNumber = myInt; // unboxing
  • 49. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Autoboxing and Unboxing You rarely need to declare numeric wrapper class objects, but they can be useful when you need to work with primitives in a context where primitives are not permitted Recall the ArrayList class, which works only with objects. ArrayList<int> list = new ArrayList<int>(); // Error! ArrayList<Integer> list = new ArrayList<Integer>(); // OK! Autoboxing and unboxing allow you to conveniently use ArrayLists with primitives.
  • 50. Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Problem Solving Example: The TestScoreReader Class Dr. Harrison keeps student scores in an Excel file. This can be exported as a comma separated text file. Each student’s data will be on one line. We want to write a Java program that will find the average for each student. (The number of students changes each year.) Solution: TestScoreReader.java, TestAverages.java