6.Math类
发表日期:2015-07-07 21:12:26 | 来源: | | 浏览(729) 分类:JAVA基础
import java.util.Random; public class MathDemo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("求平方根:"+Math.sqrt(9.0));//求平方根:3.0 System.out.println("求最大值:"+Math.max(57, 35));//求最大值:57 System.out.println("求最小值:"+Math.min(57, 35));//求最小值:35 System.out.println("2的3次方:"+Math.pow(2, 3));//2的3次方:8.0 System.out.println("四舍五入:"+Math.round(3.14));//四舍五入:3 Random random = new Random(); for (int i = 0; i < 10; i++) { System.out.println(random.nextInt(100));//小于100的随机数 } } }
- JAVA(0)
- JAVA基础(30)
- 1.JAVA开发环境配置(0)
- 2.java数据类型(0)
- 3.数组(0)
- 4.Date(0)
- 5.String 和 StringBuffer类常用方法(0)
- 6.Math类(0)
- 7.Cloneable(0)
- 8.File 文件(0)
- 9.FileReader和FileWriter(0)
- 10.RandomAccessFile(0)
- 11.FileInputStream和FileOutputStream(0)
- 12.InputStreamReader和OutputStreamWriter(0)
- 13.BufferedReader(0)
- 14.Scanner(0)
- 15.DataOutputStream(0)
- 16.Thead 多线程(0)
- 17.TimerTask(0)
- 18.zip(0)
- 19.Charset(0)
- 20.List(0)
- 21.Map(0)
- 22.Properties(0)
- 23.Enumeration(0)
- 24.Collection(0)
- 25.JDBC(0)
- 26.Iterator(0)
- 27.Abstract(0)
- 28.Interface(0)
- 29.Serializable(0)
- 30.Camparable(0)
- JSP基础(50)