
"Hi, Amigo. Here are some interesting tasks that involve catching exceptions."
9
Task
New Java Syntax,
level 9,
lesson 6
Locked
StringTokenizer
Using a StringTokenizer, split the query variable into parts based on the delimiter variable.
Example:
getTokens("java.util.stream", "\\.")
returns the string array
{"java", "util", "stream"}
9
Task
New Java Syntax,
level 9,
lesson 6
Locked
String.format()
Make the format(String name, int salary) method return a string like this:
My name is . I will earn $ a month.
Use the String.format() method to do this.
9
Task
New Java Syntax,
level 9,
lesson 6
Locked
String pool
The equal(String, String) method compares strings by reference using the == operator.
You need to make the method return true if the values (contents) of the strings are the same, and false if they are different, without using the equals() method.
"Here's a tip: write your program, see what sort of exceptions occur, and then change the code to catch them."
GO TO FULL VERSION