紅色加粗字體為關鍵要點

1.變數需用"+"符號作為相連

2.只有字串才需" "括起

/**
* @(#)putin_or_putout.java
*
*
* @author
* @version 1.00 2012/3/17
*/
import java.io.*;
public class putin_or_putout {

/**
* Creates a new instance of <code>putin_or_putout</code>.
*/
public putin_or_putout() {
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) throws IOException{
// TODO code application logic here
BufferedReader buf;
String str;

buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please input String:");
str=buf.readLine();//將輸入的文字指定給字串變數str存放

System.out.println("string="+str);//印出字串
}
}

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 scoser01 的頭像
    scoser01

    scoser01的部落格

    scoser01 發表在 痞客邦 留言(0) 人氣()