import java.util.Scanner; import javax.swing.JOptionPane; public class TypeOfIO { public static void main(String[] args){ double value = 0; JOptionPane.showInputDialog(null,"type zone.","input Demo",JOptionPane.QUESTION_MESSAGE); JOptionPane.showMessageDialog(null, "type zone." + value); Scanner scanner = new Scanner(System.in); System.out.println("type zone" + value); //控制台输入输出 } }
JOptionPane 一些常用方法: http://847353020-qq-com.iteye.com/blog/954532
控制台:Java不直接支持控制台输入,用Scanner类创建对象读取来自System.in的输入。
Scanner对象的读取输入方法:
next() nextByte() nextShort()
nextInt() nextLong() nextFloat()
nextDouble()