Basic HTML version of Foils prepared Sept 21 1998

Foil 18 java.lang.Object Wrappers

From Java Tutorial 98- 4: Multi-Treading, Useful Java Classes, I/O and Networking NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken


1 Primitive types such as int, char, float, etc. are NOT classes. Thus one cannot use methods such as
  • int var;
  • var.toString();
2 ALL primitive types have associated wrappers:
  • Character myChar = new Character( 'A' );
3 The Character class has methods such as:
  • if ( myChar.equals( ch ) ) ...
  • System.out.print( myChar.toString() );
4 There are also many static (class) methods:
  • ch = Character.toLowerCase( myChar );
  • if ( Character.isUpperCase( myChar ) ) ...
5 The methods in a wrapper class are also useful to convert types, such as a String to a Double.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998