String a=new String("SMS Message");

this line means that you reserved a memory pointed by a and has the value "SMS Message". So when you say if(a==b), you are comparing the addres of the memory (like JamesCherrill said). But what you want to do is to compare the value of this memory so you use the "equals" method


hope this help.

I always stuck in these situation about resizing buttons. so i will suggest you my solutions and if you find a better one please share:

1)the BoxLayout, instead of using gridLayout at line 67 you can use this oakpane.setLayout( new BoxLayout(oakpane, BoxLayout.X_AXIS) );

2)a FlowLayout panel into the oakpane, create a new panel, add the button to it and then add the panel to oakpane.

JPanel pa = new JPanel();
a = new JButton(new ImageIcon("charopt.png"));
a.setSize(150, 267);

I hope this help.

at line 21 you misspelled the fib4() (lowercase f) method.
and fib4(i), i is long but it should be integer.
I hope this help

JamesCherrill commented: You are right! +15

1- when you enter your number from the keyboard, you should press enter to commit the value entered.
2- your code is 100% correct:

while (condition is true)
    do something here

so while the number!= -1, you keep entering new number, when the number you entered is equal -1, that means the condition in while statment is false, so you will exit the while loop.

i hope this help you.

u have a interface name Shape,
next you created an abstract class named Shape2 that implement the interface,
next you created 4 classes (Square, Triangle, Octagon,Circle) that should extends the abstract class,
so this is the first error i think, you should replace "class Square" with "class Square extends Shape2" and the same for the 3 others class.
and i'm not sure what the methods in line 31,32,33,34, if you mean to draw the shapes i think you should use the method from the abstract class
shape1.drawShape(g), and the same for the other shapes. I hope this help.