jcreator初学者不错,等熟悉java后使用myeclipse或eclipse.
jbuilder,netbeans也可以,但我自己不喜欢,所以也就不推荐了.还有myeclipse和eclipse作桌面项目没有jbuilder和netbeans方便,但作企业级的非桌面项目,真的很方便.
直接使用System.in.read()方法返回得是int型得值,需要将int转换为char,然后在组合成字符串,很不方便,可以使用如下方式:
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class ReadString
{
public ReadString()
{
}
public static void main(String [] arguments)throws Exception
{
System.out.println("请输入内容");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String inputStr = br.readLine();
System.out.println(inputStr);
}
}
这样做吧:
try {
String s = String.valueOf(System.in.read());
} catch (IOException e) {
e.printStackTrace();
}
你用eclispe吧,下载地址:http://www.eclipse.org/downloads/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) {
String str = "";
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
System.out.print("请输入字符串:");
try {
str = br.readLine();
System.out.println();
System.out.println("您输入的字符串为:"+str);
} catch (IOException e) {
e.printStackTrace();
}
}
}
read()返回的是int型,输入字符的话返回单个字符的ASCII码,
int a;
String s="";
while((a=System.in.read())!=-1){
s+=(char)a;
}
用eclipse