这是我的代码:---找不到符号方法console();
import java.lang.*;
class Console
{
public static void main(String args[])
{
char i;
i=System.console().readLine("this is how we give he input to the string");
System.out.println("this is what we want to print:0)");
System.out.println(i);
}
}
和我得到的输出是这样的: -
输出: -
.java:7: cannot find symbol
symbol : method console()
location: class java.lang.System
i=System.console().readLine("this is how we give he input to the string");
^
1 error
Tool completed with exit code 1
如果有人能帮助我了...
可能重复[如何获取输入从控制台类在Java?(http://stackoverflow.com/questions/4644415/how-to-get-输入从控制台-CL ass-in-java) – Eric
随着Console类的添加,您需要使用Java 1.6或1.7进行编译。 –
你在jdk1.5我相信,升级,你应该通过 – Satya