import java.util.*;
import java.io.*;
public class MyNumberProcess {
public static void ProcessNumber(){
System.out.println("input data:");
BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in));
String result=null;
try {
result = bReader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int myint;
double mydouble;
try{
myint=Integer.parseInt(result);
System.out.println("data result(Int) is: "+myint);
} catch (NumberFormatException e) {
//format error
try {
mydouble=Double.parseDouble(result);
System.out.println("data result(double) is: " +mydouble);
} catch (NumberFormatException e1) {
System.out.println("data format error");
return;
}
}
return;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ProcessNumber();
}
import java.io.*;
public class MyNumberProcess {
public static void ProcessNumber(){
System.out.println("input data:");
BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in));
String result=null;
try {
result = bReader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int myint;
double mydouble;
try{
myint=Integer.parseInt(result);
System.out.println("data result(Int) is: "+myint);
} catch (NumberFormatException e) {
//format error
try {
mydouble=Double.parseDouble(result);
System.out.println("data result(double) is: " +mydouble);
} catch (NumberFormatException e1) {
System.out.println("data format error");
return;
}
}
return;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ProcessNumber();
}
1562

被折叠的 条评论
为什么被折叠?



