Question 1)
Write a class StringButtons extends JFrame, such that
java StringButtons string0 string1 ... stringN displays a frame with a N+1 buttons on one row, and the buttons have label string0, string1,... stringN repectively.
Here is the output for
java StringButton This is the answer




Question 2)
Write a class StringLength such that
java StringLength string1 string2 .. stringN returns the sum of length of all the strings..
Example, java StringLenght How long are the strings
gives me 3 + 4 + 3 + 3+ 7 = 20.


Question 3)
Write a class RemoveDigit such that
java RemoveDigit string1 string2 ... stringN remove all the digits from all the strings and display them.
Example,
C:>java RemoveDigit PIC10A is number1
PICA is number
Useful methods:
class Character
static boolean isDigit(char ch) : return true if ch is a digit.
class String
char[] toCharArray(): return the string in form of an array of characters.

Question 4)
We have
String string = "hi";
char[] array = {'h','i'};
Which of the following lines are correct?
(a) string.length;
(b) string.length();
(c) array.length;
(d) array.lengt()

Question 5)
(a) Write down some constructors for JLabel, JButton.
(b) Write down some constructors for Color and Font
(c) do you know how to use the following methods for
Graphics class? drawString, drawOval, fillOval, drawRect, fillRect, drawArc, fillArc, setColor, setFont?

Question 6) Do you remember the rules for identifies? Which of the followings are legal identifies? (i) aBook (ii) 2Books (iii) a_long_name (iv) go2where (v) funny-book (vi) one+two (vii) public