Professional Documents
Culture Documents
1 (Points: 10.0)
.
How do you convert a char, an array of characters, or a number to a string?
2. By String.parseString() method
3. By convertTo method of the char, array or number
表單的底部
2.
(Points: 10.0) Suppose string s is created using new String(); what is s.length()?
3.
(Points: 10.0) There is some methods that can change the contents of the string. True
4.
(Points: 10.0) What is the printout of the following code?
5.
(Points: 10.0) Which line of the following program is wrong?
1.
6.
(Points: 20.0) Suppose that s1 ,and s2 are two strings, given as follows:
01? 02
s1 = = s2 s1.length()
True 15
s1.equals(s2) 03 s1.substring(5, 11) 04
True me to
05 06
s1.charAt(0) s1.startsWith("Wel")
W Welcome to Java
07 08
s1.indexOf('j') s1.toLowerCase()
-1 Welcome to java
09 10
s1.indexOf("to") s1.lastIndexOf('a')
8 14
7.
(Points: 10.0) Consider the program below:
Show the value of s1 after each of the following statement. Assume that the following
statements are independent.
01 02
s1.append(" is fun"); s1.deleteCharAt(3);
Java is fun Jav
03 04
s1.append(s2); s1.delete(1, 3);
JavaHTML Ja
05 06
s1.insert(2, "is fun"); s1.reverse();
Jais funva avaJ
07 08
s1.equals(s2); s1.replace(1, 3, "Computer");
False JComputervComputer
09 10
s1.charAt(2); s1.substring(1, 3);
v av
11 12
s1.length(); s1.substring(2);
4 v