最简单的程序错误:见内

zhf406 2002-04-04 02:07:48
import java.io.*;
/*
JHelloWorld
@author zhf
@version helloworld 1.0
*/
class JHelloWorld
{
public static void main(String[] args)
{
String str;
DataInputStream stream=new DataInputStream(System.in);
System.out.println("Please Enter Words:\n");
str=stream.readline();//不能识别
System.out.println(str);
try
{
stream.close();
}
catch(IOException e)
{
}
}
}
错误提示:
---------- javaC ----------
JHelloWorld.java:14: cannot resolve symbol
symbol : method readline ()
location: class java.io.DataInputStream
str=stream.readline();
^
1 error
...全文
63 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhf406 2002-04-04
  • 打赏
  • 举报
回复
谢谢二位了
分已加
再次感谢
coollbt 2002-04-04
  • 打赏
  • 举报
回复
我给你改了一下

import java.io.*;
/*
JHelloWorld
@author zhf
@version helloworld 1.0
*/
class JHelloWorld
{
public static void main(String[] args)
{
try
{
String str;
DataInputStream stream=new DataInputStream(System.in);
System.out.println("Please Enter Words:\n");
str=stream.readLine();//不能识别
System.out.println(str);

stream.close();
}
catch(IOException e)
{
}
}
}

你的readline()应该这样写readLine(),“l”应为大写
idpmud 2002-04-04
  • 打赏
  • 举报
回复
是的方法名写错了,readLine();

62,622

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧