Chapter 10

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Appendix C.  Answers to Review Questions


A1:

Object Wrappers are serializable classes and thus can be safely passed between classes possibly running inside different processes.

A2:

Use the Integer.parseInt( String s ) method.

A3:

Immutability means that an object's value cannot be changed; in order to change the value of an immutable class, a new instance of the class must be created with the new value and the old value is orphaned in memory.

A4:

Because strings are immutable, Java has created the notion of a string table that represents all strings running in an application; this is an optimization so that only one instance of a string is represented in memory even if multiple variables are referencing it.

A5:

Java has created the notion of a string table that represents all strings running in an application; this is an optimization so that only one instance of a string is represented in memory even if multiple variables are referencing it.

A6:

The String class is immutable while the StringBuffer class is not; the StringBuffer class is free to change its value without having to orphan its old value in memory and create a new instance in memory as the String class does.

A7:

The StringBuffer class provides a reverse() method that reverses the contents of a string.

A8:

The StringTokenizer class is a utility class that takes a String and returns tokens, with delimiters defined by the caller, back to the caller.

A9:

A delimiter defines the characters that separate tokens.

A10:

Some of its uses include parsing text based documents into words or parsing comma-separated value (CSV) files into their comma-separated values.


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net