import java.awt.Container;
import javax.swing.*;
public class Maximun extends JApplet{
public void init()
{
String s1=JOptionPane.showInputDialog(
"enter first floating-point value");
String s2=JOptionPane.showInputDialog(
"enter second floating-point value");
String s3=JOptionPane.showInputDialog(
"enter third floating-point value");
double number1=Double.parseDouble(s1);
double number2=Double.parseDouble(s2);
double number3=Double.parseDouble(s3);
double max=maximun(number1,number2,number3);
JTextArea outputArea=new JTextArea();
outputArea.setText("number1: "+number1+"\nnumber2: "+number2+"\nnumber3: "+number3+"\nmaximum is : "+max);
Container container=getContentPane();
container.add(outputArea);
}
public double maximun(double x,double y,double z)
{
return Math.max(x,Math.max(y,x));
}
}
我是用JCreator Pro编译的.可运行没反应.请指点一 二.