day18/MathTest.java

来源:互联网 发布:常用的电气设计软件 编辑:程序博客网 时间:2024/06/05 06:48
/*练习:给定一个小数,保留两位小数。*/class MathTest {public static void main(String[] args) {show(12.3456);}public static void show(double d){String s = Double.toString(d);char[] chs =s.toCharArray();for(int x=0;x<chs.length;x++){if(chs[x]=='.')int index = x;//System.out.println(chs[x]);}for(int x =0;x<x+2;x++)}}

0 0