Use the following command to generate a window input dialog
String myString=JOptionPane.showInputDialog("Enter a number: ");
use the following command to convert a string to a number
int myNumber = Integer.parseInt(myString);
and finally use the following command to print the input number to the console
System.out.println("The number is "+ myNumber);
Don't forget the following import command
import javax.swing.JOptionPane;
so that Java can recognize JOptionPane library.
9326149 電子二甲 朱衍印
回覆刪除Lab JOptionPane
電子二乙 9326230 張惠雯
回覆刪除10/17上課練習程式
電子四乙 9126266 莊傑迪
回覆刪除okay
回覆刪除電子三丙 簡宏達 9226348
已經完成 電子三丙 林鉦凱
回覆刪除9326311 電子二丙 余幸娟
回覆刪除JOptionPane
電子三甲 9226135 阮文正
回覆刪除9228213 電機三乙 喻俊嘉
回覆刪除http://s9228213.blogspot.com/
電子三乙 9226262 朱政宏
回覆刪除Lab JOptionPane完成
9326323 林敬凱 電子二丙
回覆刪除Lab JOptionpane
JOptionPane
回覆刪除電子二乙
9326247
柯佑霖