Slides 03
Slides 03
String title;
count = title.length()
num1 38
num1 38
Before:
num2 96
num2 = num1;
num1 38
After:
num2 38
name2 = name1;
• Or you can import the class, and then use just the
class name
import java.util.Scanner;
import java.lang.*;
• These include:
absolute value
square root
exponentiation
trigonometric functions
getCurrencyInstance()
getPercentInstance()
Season time;
time = Season.fall;
num = Integer.parseInt(str);
• The wrapper classes often contain useful
constants as well
• For example, the Integer class contains
MIN_VALUE and MAX_VALUE which hold the
smallest and largest int values
© 2004 Pearson Addison-Wesley. All rights reserved 3-36
Autoboxing
• Autoboxing is the automatic conversion of a
primitive value to a corresponding wrapper object:
Integer obj;
int num = 42;
obj = num;