16编写字符界面应用.ppt

16编写字符界面应用.ppt

编写字符界面应用 Math类 字符串类 集合类 文件操作 Deprecation Math类 Math类中包含了一组数学函数 截取:ceil、floor、round(四舍五入) 变量的max、min、abs 三角函数:sin、cos、tan、asin、acos、atan、toDegrees和toRadians 对数指数:log和exp 其它:sqrt、pow、random 常数:PI、E Math类使用例子(示例9-6) public class TestMath { public static void main(String[] args) { //得到一个随机数 double d = Math.random(); System.out.println(d); //计算半径为10的圆的周长 double p = 2*Math.PI*10; System.out.println(p); } } String类 String对象代表一组不可改变的Unicode字符序列 它的方法可用来创造新的字符串:concat(连接)、replace、substring、toLowerCase、toUpperCase和trim。 查找字符的方法:endWith、startWith、 indexOf、 lastIndexOf。 比较字符的方法:equals、equ

文档评论(0)

1亿VIP精品文档

相关文档