close
import javax.swing.JOptionPane;
public class PrintVAR {
public static void main(String args[])
{
int i ; //宣告變數並設定起始值
String s ; //儲存使用者輸入的字串
s = JOptionPane.showInputDialog("輸入一個整數");
i = Integer.parseInt(s);
System.out.println(i); //輸出變數值
System.out.print("i = " +i); //用 + 運算子,串聯字串與變數
}
}
文章標籤
全站熱搜