請將由鍵盤中輸入的字元,前後3個 * 包圍,假設輸入的字元是A,則輸出結果為 *** A ***
import java.io.*;
public class hw3_23
{
public static void main(String args[]) throws IOException
{
BufferedReader buf;
String str;
char ch;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print(" 請輸入一個字元 :");
str=buf.readLine();
ch=str.charAt(0);
…
}
}
我寫到這...
請問有遺漏什麼嗎?
謝謝
2007-10-12 18:18:02 · 3 個解答 · 發問者 啊哈 1 in 電腦與網際網路 ➔ 程式設計
import java.io.*;
public class hw3_23
{
public static void main(String args[]) throws IOException
{
BufferedReader buf;
String str;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print(" 請輸入一個字元 :");
str=buf.readLine();
System.out.print("***"+str+"***");
}
}
2007-10-12 18:47:53 · answer #1 · answered by ? 2 · 0⤊ 0⤋
import java.io.*;
import java.util.*;
public class TEST
//檔名:TEST.java
{
public static void main(String[] args)
{
PrintStream o=new PrintStream(System.out);
Scanner i=new Scanner(System.in);
o.printf("Input a charcter: ");
String s=i.next();
o.printf("***%s***\n",s);
}
}
2007-10-13 06:55:51 · answer #2 · answered by Big_John-tw 7 · 0⤊ 0⤋
ysnycneyagnvugqiunwvquhmqooooooooooooooooooovhomozivxcx
2007-10-12 18:22:39 · answer #3 · answered by 逸逸 2 · 0⤊ 0⤋