close
紅色加粗字體為關鍵要點
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);//印出字串
}
}
全站熱搜