如何创建可以显示作为参数提交的数字的平方根的应用程序?到目前为止,我有:
import java.awt.*;
public class RootApplet extends javax.swing.JApplet {
int number;
public void init() {
number = 225;
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D) screen;
screen2D.drawString("The square root of " + arguments[0] +
" is"
Math.sqrt(number));
}
}
但是根据运行时错误,我显然遗漏了一些东西。`错误。