public class StringtoUpper {
public static void main(String[] args) {
/*String s = "weixin_textmsg";
System.out.println(s.toUpperCase());*/
try {
System.out.println("---->"+10/0);
} catch (Exception e) {
System.out.println("e---->"+e);
}
System.out.println("----------------");
try {
System.out.println("---->"+(double)10/0);
} catch (Exception e) {
System.out.println("e---->"+e);
}
}
}
为了程序能够进行下去,我用了try...catch,这是打印结果:
e---->java.lang.ArithmeticException: / by zero
----------------
---->Infinity
由此可见,对于整数型,除以0会出现算法异常;但对于浮点型,却表现为无限的意思