以下Java程序代码哪里出错了

来源:百度知道 编辑:UC知道 时间:2024/06/20 04:51:02
import java.io.*;
public class p61_2_7_2//判断所输入数据是否在0-9
{
public p61_2_7_2()
{
int x=0;
}

public void judge()throws java.io.IOException
{
System.out.println("判断所输入数据是否在0-9");
System.out.println("输入数据");
BufferedReader distream=new BufferedReader(new InputStreamReader(System.in));
int i=Integer.parseInt(distream.readLine());
if(i>=0&&i<=9)
{
System.out.println("oh YeYe!");
}
else
{
System.out.println("No!No!No!");
}
}

public void rego()throws java.io.IOException
{
System.out.println("选‘Y’为继续,‘N’为推出");
String m="";
BufferedReader d=new BufferedReader(new InputStreamReader(System.in));
m=d.re

静态方法不能直接调用类的非静态方法,错误太多,不加循环怎么继续?? 字符数据转换异常怎么办??
import java.io.*;

public class p61_2_7_2// 判断所输入数据是否在0-9
{
public p61_2_7_2() {
int x = 0;
}

public static void judge() {
System.out.println("判断所输入数据是否在0-9");
System.out.println("输入数据");
BufferedReader distream = new BufferedReader(new InputStreamReader(
System.in));
int i;
try {
i = Integer.parseInt(distream.readLine());

if (i >= 0 && i <= 9) {
System.out.println("oh YeYe!");
} else {
System.out.println("No!No!No!");
}
} catch (NumberFormatException e) {
System.out.println("No!No!No!");
} catch (IOException e) {
e.printStackTrace();
}
}

public void rego() throws java.io.IOException {
while (true) {
System.out.println("选‘Y’为继续,‘N’为推出");
String m