
String and String Buffer • 281
1. Distinguish between the following terms:
(a) String and StringBuffer
(b) Length and length()
( c) equal and ==
( d) length() and capacity()
( e) setCharAt() and insert()
2. What is wrong in the following code:
Vector v = new Vector(10);
v.addElement(21);
3. Write a program that accepts a name list of five
students from the command line and store in a
vector.
4. Write a program to generate Fibonacci series
where the data are saved in vector.
5. Write a method called remove (String s1, int n)
that returns the input string with nth element
removed.
Explanation: The program is simple ...