day20
常用API:
1.Math类:无构造方法,类的成员是static,所以可用类名直接调用
public static int abs(int a)//返回绝对值
public static double ceil(double a)//返回大于等于参数的最小double值,等于一个整数
public static double floor(double a)//返回小于等于参数的最大double值,等于一个整数
public static int round(float a)//四舍五入返回最接近参数的int
public static int max(int a,int b)
public static int min(int a,int b)
public static double pow(double a,double b)//返回a的b次幂的值
public static double random()//返回值为double的正值,[0.0,1.0]
2.System类:无构造方法,类的成员是static,所以可用类名直接调用
public static void exit(int a)//终止当前运行的java虚拟机(程序停止运行),非0 表示异常终止
public static long currentTimeMillis()//返回当前时间)(以毫秒为单位)
3.Object类:每个类都直接或间接继承该类
构造方法:public Object();
toString();//返回对象的字符串表示形式,所有子类重写该方法
equals();
Object类的两个方法都是在类中重写,自动生成
浙公网安备 33010602011771号