Question 1)
Write a class StringButtons extends JFrame, such that
java StringButtons string0 string1 ... stringN will shows me 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 return 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
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)
Write a class NumberLabels extends JPanel with 2 static int HORIZONTAL and VERTICAL. It shows 9 labels with number 1,2,3,4,5,6,7,8,9 on it with given orientations. There are one constructor
public NumberLabels(int orientation)

NumberLabels(NumberLabels.VERTICAL)

NumberLabels(NumberLabels.HORIZONTAL)
Question 5)
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 6)
(a) Tell me all the constructors for JLabel, JButton,JPanel.
(b) Tell me 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 7) 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) final.