// (from the Carter book)
// StringTokenizer class Constructors --> INTRODUCTION to the
// Constructor method
//
// This class has 3 different constructors (thus, the constructor
// method is "overloaded"). Each constructor has one String
// parameter that is used to create a StringTokenizer object.
// However, they differ in their treatment of delimiters.
//
// 1. Here is how the header is defined for the first version:
//
// public StringTokenizer (String s)
//
// This default constructor, as shown in Example 1A, creates a
// StringTokenizer object for the String "s". As we noted
// before, this version uses BLANKS as delimiters. It also
// uses other white space characters (such as, newlines, tabs,
// carriage returns, or formfeeds) as delimiters.
//
// 2. Here is how the header is defined for the second version:
//
// public StringTokenizer (String s, String d)
//
// This constructor constructs a StringTokenizer object for
// the String "s", using any of the characters in String "d"
// as delimiters. The characters in String "d" are NOT treated
// as tokens.
//
// 3. Here is how the header is defined for the third version:
//
// public StringTokenizer (String s, String d, boolean flag)
//
// Like version #2's constructor, this one creates a StringTokenizer
// object for the String "s", using any of the characters in String
// "d" as delimiters. Now, however, if the value of "flag" is true,
// then the delimiter characters are also returned as tokens. (Each
// delimiter is returned as a token of length one.) If "flag" is
// false, however, this constructor behaves just like version # 2's
// constructor, with characters in String "d" being NOT treated like
// tokens.
public class StringTokenizerExample1B
{
public static void main (String[] args)
{
// Place your code here
} // main method
} // StringTokenizerExample1B class
No comments:
Post a Comment