第一天写JAVA程序,遇到个难题,相信难不倒您吧!----大侠请进,内附完整代码。 怎么转?在JAVA下没有直接的方法,必须要手工转的吗?接受用户输入一个整数,这在C++下可是一条语句的事啊!可我从早上开始写这个程序。也问了好几个JAVA高手了,居然现在还没解决! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个你也可以试试,看起来应该方便一点!BufferedReader input = new BufferedReader(new InputStreamReader(System.in));String strValue=input.readLine();try{int intValue = Integer(a).value();}catch(Exception e){//error} 再定义一个变量Stirng xx;将i = in.readInt();改为 xx=in.readLine(); i=Integer.parseInt(xx);即可 i = in.readInt();-->i = Integer.parseInt(in.readLine()); 试一下这个,public static void main(String[] args) { try { DataInputStream in = new DataInputStream(new BufferedInputStream(System.in)); int i; String strToint; Point_Demo point1; point1 = new Point_Demo(); System.out.println("input point X:"); strToint = in.readLine().trim(); i = Integer.parseInt(strToint); point1.set_X( i ); System.out.println("input point Y:"); strToint = in.readLine().trim(); i = Integer.parseInt(strToint); point1.set_Y( i ); System.out.println("Point set in:(" + point1.get_X() + "," + point1.get_Y() + ")"); } catch(Exception ex) { System.out.println("Error"); } } 有会java 单字节加密解密的吗 包装器类 自动装箱 取消装箱 这三个名词是什么意思?谁教我一下 应该怎么理解。 JDeveloper 关于解析嵌套公式的问题 求救!在两个Jframe类怎么传递数据?在线等…… 抽象类可以被实例化吗? 请求大侠们的帮助,小女子有理了!!!!!!!! 怎样把一个字符串中的\\u变为\u,急? 为什么运行swing程序时,一切换输入法程序就死(Windows Xp,JDK1.4) 多线程 java初级问题??? 怎样才能在系统中使用sun.jdbc.rowset.CachedRowSet类!
String strValue=input.readLine();
try{
int intValue = Integer(a).value();
}catch(Exception e){//error}
将i = in.readInt();改为
xx=in.readLine();
i=Integer.parseInt(xx);
即可
-->
i = Integer.parseInt(in.readLine());
public static void main(String[] args)
{ try
{
DataInputStream in = new DataInputStream(new BufferedInputStream(System.in));
int i;
String strToint;
Point_Demo point1;
point1 = new Point_Demo();
System.out.println("input point X:");
strToint = in.readLine().trim();
i = Integer.parseInt(strToint);
point1.set_X( i );
System.out.println("input point Y:");
strToint = in.readLine().trim();
i = Integer.parseInt(strToint);
point1.set_Y( i );
System.out.println("Point set in:(" + point1.get_X() + "," + point1.get_Y() + ")");
}
catch(Exception ex)
{
System.out.println("Error");
}
}