BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String test = reader.readLine();
String test = reader.readLine();
解决方案 »
- Java中ImageIcon无法动态更新的问题
- 软件设计疑难问题,求解?
- 线程结束不了
- 关于Timer定时器的一个疑问
- 这个问题很菜,我忘了怎么解决。谢谢
- java的process问题
- 在WEB-INF/lib下有两个版本的相同的lib,那么classloader会装载那一个了?
- 请教大家一个用socket传送图片的问题。。。。。
- 类中怎样使用其他类的方法???
- 请问各们JAVA高手,我想学JAVA,请问是VJ好还是JB好,如何入手。谢谢了。我现在最多可以出22分。以后加分
- 如何在Application中实现类似于Rational Rose的画图功能
- 急!以前编译都通过的文件现在怎么都编译通不过。而且报同样的错。高手请进。
String s=br.readLine();
这里可以读入一行字符,当然包括单个字符啦
byte[] lb_Read = new byte[100];
System.in.read(lb_Read);
for(int i = 0;i < lb_Read.length; i++)
{
char c = (char)lb_Read[i];
if(c == 10 || c == 13) break;
ls_Read += c;
}
return ls_Read;
1。 只读一个字符:
char a;
try{
a = (char)System.in.read();
}catch(IOException ex){
}
BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
public class p14
{
public static void main(String[] args)
{
char c=0;
System.out.print("enter a letter:"); //输出语句
try{ //try{}到catchcatch(IOException e){};是例外处理
c=(char)System.in.read(); //输出语句
}catch(IOException e){};
System.out.println("the letter is:"+c); //输出语句
}
}
public class c
{
public static void main(String[] args)
{
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String test = reader.readLine();}
catch(Exception ex)
{
System.out.println(ex);
} System.out.println(test);
}
}显示错误:
c.java:14: cannot resolve symbol
symbol : variable test
location: class c
System.out.println(test);
^
1 error
import java.io.*;public class c
{
public static void main(String[] args)
{
String test=null; try{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
test = reader.readLine();}
catch(Exception ex)
{
System.out.println(ex);
} System.out.println(test);
}
}