- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- public class P5 {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- String str;
- int n;
- P5() throws Exception
- {
- System.out.print("請輸入一字串(帶空白): ");
- str=br.readLine();
- System.out.println(str);
- System.out.print("請輸入一整數: ");
- n=Integer.parseInt(br.readLine());
- System.out.println(n);
- }
- public static void main(String[] args) throws Exception{
- new P5();
- }
- }
複製代碼 |