导入包:Import java .util.Scanner; Scanner input=new Scanner(System.in); double num=new input.nextDouble();//从键盘读入一个数值,并且将数值付给双精度num; byte byteValue=input.nextByte();//从键盘读入一个数值,并且将数值付给byte 类型byteValue; short shortValue =input.nextShort();//从键盘读入一个数值,并且将数值付给short型 shortValue; int intValue=input.nextInt();//从键盘读入一个数值,并且将数值付给整型intValue; long longValue=input.nextLong();//从键盘读入一个数值,并且将数值付给longValue; float floatValue=input.nextFloat();从键盘读入一个数值,并且将数值付给floatValue;
导入包:import javax.swing.JOptionPane; String num=JOptionPane.showInputDialog(“Enter yearly interest rate,for example:8.25”);//在对话框出现的提示语: double num1=Double.parseDouble(num);//将从对话框输入的数附给num1
String output =”The monthly payment is”+num1; //对话框输出的内容 JOptionPane.showMessageDialog(null,output) ***JOptionPane.showMessageDialog(null,“/u6B22/u8FCE/U03b1/u03B3”, “/u6B22/u8FCE Welcome“JOptionPane.INFORMATTON_MESSAGE); //u6B22/u8FCE/U03b1/u03B3!对应对话框中的 //u6B22/u8FCE Welcome对应对话框中的 //JOptionPane.INFORMATTON_MESSAGE!对应对话框中的
新闻热点
疑难解答