import java.io.*;
public class MyName
{
public static void main (String [] xxx) throws IOException
{
String a;
BufferedReader read = new BufferedReader (new InputStreamReader (System.in));
System.out.print("Input A Name : ");
a = read.readLine();
System.out.print("\n");
System.out.println("Your Name : " +a);
System.out.println("Name Capacity: " +a.capacity());
System.out.println("Length Of A Name : "+a.length());
/*After the first word of the name (if the name is more than one word)
then the first letter of each word must in uppercase*/
System.out.println((a)+" change to = ".....); //i have no idea what code to wite
}
}
輸入:丹尼爾天劉易斯如何結合InputStreamReader和StringBuffer?
預期輸出:
丹尼爾天路易斯= ... - >輸入字符串的容量
丹尼爾天路易斯= ... - >輸入的長度串
「丹尼爾·戴 - 劉易斯」 改爲 「丹尼爾·戴·劉易斯」
什麼是你的問題?如何大寫單詞的字符串?從消息中讀取後續行? – 2011-01-20 09:19:56
請幫助我.. ?? – fortysant 2011-01-20 09:23:01
@fortysant,您的標題顯然與代碼中隱藏的問題不匹配。請再次編輯它,改變標題並添加幾個詞來描述你真正需要的東西。一個示例用於輸入和期望輸出的字符串也會有幫助! – 2011-01-20 09:33:57