what's problem with this code?
package javaapplication76;
import java.awt.*;
import java.applet.*;
import javax.swing.*;
/**
*
* @author Ashik
*/
public class ApplerTesting extends Applet{
TextField textfield1,textfield2;
public void inti(){
textfield1=new TextField();
textfield2=new TextField();
add(textfield1);
add(textfield2);
textfield1.setText("0");
textfield2.setText("0");
}
public void paint(Graphics graphics){
int textfield1Numer, textfield2Numer,Answer;
String textfield1String,textfield2String,AnswerString;
graphics.drawString("please enter two number in the txtfield", 100, 200);
try{
textfield1String=textfield1.getText();
textfield1Numer=Integer.valueOf(textfield1String);
textfield2String=textfield2.getText();
textfield2Numer=Integer.valueOf(textfield2String);
Answer=textfield1Numer+textfield2Numer;
AnswerString=String.valueOf(Answer);
graphics.drawString("The summation is"+AnswerString, 100, 500);
}
catch(ArithmeticException arithmeticException){
JOptionPane.showMessageDialog(null,arithmeticExcep tion);
}
}
public Boolean action (Event event, Object object)
{
repaint();
return true;
}
}
Re: what's problem with this code?
You tell us. What does your code do? Does it throw an Exception? If so, post it here. Does it exhibit a weird behavior? If so, explain it in detail. Does it gain sentience and start plotting to overthrow humanity? If so, unplug your computer.
Also, please use the highlight tags to preserve formatting when posting code. Unformatted code makes our eyes bleed.