| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1177 人关注过本帖
标题:java输出最大数
取消只看楼主 加入收藏
wxzyn123
Rank: 1
来 自:江苏
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-9-15
收藏
 问题点数:0 回复次数:1 
java输出最大数

import java.io.*;
public class MyMath
{
//static int a,b,c;
public static void Max(int a,int b,int c)
{
if(a>b)
{
if(a>c) System.out.println("the bigest number is "+a);
else System.out.println("the bigest number is "+c);
}
else
{
if(b>c) System.out.println("the bigest number is "+b);
else System.out.println("the bigest number is "+c);

}
}
public static void main(String[] args)throws IOException
{
MyMath m=new MyMath();
int n1;
int n2;
int n3;
System.out.println("please enter the first number:");
n1=(int)System.in.read();
System.out.println("please enter the second number:");
n2=(int)System.in.read();
System.out.println("please enter the third number:");
n3=(int)System.in.read();
m.Max(n1,n2,n3);
}
}

就是这个,就是要求输入三个数,然后输出最大数

运行时只输入一个数就结束程序了,不知道问题出在哪


搜索更多相关主题的帖子: java 大数 int number 
2007-10-17 19:18
wxzyn123
Rank: 1
来 自:江苏
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-9-15
收藏
得分:0 
谢谢你们
2007-10-18 16:19
快速回复:java输出最大数
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012044 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved