Using the API Worksheet
Object Methods vs Class (Static) Methods (API)
Created by: Barb Ericson
Georgia Institute of Technology
1. Use the API for the String class (java.lang.String) to answer the following:
a. How would you find the first position in a string of another string?
b. How would you find the last position in a string of another string?
c. How would you remove leading and trailing spaces from a string?
d. How do you get the number of characters in a string?
e. How do you convert a string to lowercase letters?
f. How can you tell if two strings have the same characters?
g. How can you convert a number to a string?
2. Use the API for the Math class (java.lang.Math) to answer the following:
a. How can you use the Math class to calculate 2 to the 10th power?
b. How can you use the Math class to find the square root of a number?
c. How can you use the Math class to round a decimal number?
d. Are there any methods in the Math class that aren’t class methods?
3. Use the API for the Integer class (java.lang.Integer) to answer the following:
a. What method can you use to convert a string to an integer value?
b. What happens if you try to convert a string that doesn’t contain a number?
c. Are there any methods in the Integer class that aren’t class methods?
4. Use the API for the Double class (java.lang.Double) to answer the following:
a. What method can you use to convert a string to a double value?
b. What happens if you to convert a string that doesn’t contain a valid decimal?
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- ap computer science
- chapter 1 preview of java fundamentals
- chapter 3 data types and operations on data
- creating objects ucf computer science
- using the api worksheet
- object oriented programming programming assignment 3
- big java java concepts lab 1 ryerson university
- introduction to programming
- understanding tostring method
Related searches
- word using the letters
- words using the letters verify
- words using the following letters
- words using the letters money
- find words using the letters
- words using the letters ussequi
- not using the word i
- 6 letter words using the letters
- 7 letters words using the following letters
- form a word using the following letters
- six letter words using the letters
- four letter words using the letters found