public class Try
{public static void main(String args[])
throws java.io.IOException
{int x;
x=System.in.read();
System.out.println(+x);
}
}
我要使输入一个整数,再输出它,怎么写???,上面的个程序为什么总是输出它的ASCII值呢???多谢各位了
{public static void main(String args[])
throws java.io.IOException
{int x;
x=System.in.read();
System.out.println(+x);
}
}
我要使输入一个整数,再输出它,怎么写???,上面的个程序为什么总是输出它的ASCII值呢???多谢各位了
解决方案 »
- 括号内有分隔符的字符串分割
- java继承
- windows 服务调用tomcat ,不显示黑窗体
- 关于数据结构的重要性问题
- 如何扩大程序的执行范围?
- 请教关于javax.servlet.RequestDispatcher.forward(request, response)
- DefaultTableModel问题
- 我出来乍道,请大家多多关照.有一个很简单又着急的问题,我在线等候.
- 怎样在jbuilder6.0里面,安装配置jdk1.4(在线关注)
- 这个界面为什么不能被其他的界面调用呢??请知道的大神知道一下
- java应用程序中使用odbc数据源连接数据库,如何获取已经定义的odbc数据源的用户名和密码?
- 研究搜索引擎的高手和lucene的高手 请进 立刻给分
自己答了算了
//显示输入面板的例子
import javax.swing.JDialog;
import javax.swing.JOptionPane;
public class JOptionPane
{
public static void main(String[] args)
{String A=JOptionPane.showInputDialog("please inprint number!");
int B=Integer.parseInt(A);
int C=B;
JOptionPane.showMessageDialog(null, C, "B", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
x=System.in.read();
System.out.println(+x);
换成
String x;
x=System.in.readline();
System.out.println(x);
class AAA
{
public static void main(String[] args)
{
try{
int x;
x=System.in.read();
System.out.println((char)x);
} catch(Exception e) {
e.printStackTrace();
}
}
}
100%好使,多谢,尽快散分!:)
import javax.swing.JOptionPane;
public class JOptionPane {
public static void main(String[] args) {
String A=JOptionPane.showInputDialog("please inprint number!");
int B=Integer.parseInt(A);
int C=B;
JOptionPane.showMessageDialog(null, C, "B", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
都不能用,我以为是什么好东西
int C=B;修改为Integer C = new Integer(B);
程序如下:
import javax.swing.JDialog;
import javax.swing.JOptionPane;
public class tttt {
public static void main(String[] args) {
String A=JOptionPane.showInputDialog("please inprint number!");
int B=Integer.parseInt(A);
Integer C=new Integer (B);
JOptionPane.showMessageDialog(null, C, "B", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
public class T { public static void main(String[] args)
{
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true)
{
String x = br.readLine();
if(x.equals("exit"))
break;
System.out.println(x);
}
} catch(Exception e) {
e.printStackTrace();
} }
}