System类的一般用法
System类的一般用法
概述
常用方法
gc
exit 退出虚拟机
currentTimeMillis
arraycopy
概述
System类包含一些有用的字段 和 方法,它不能被实例化
public static void gc():运行垃圾回收器。
public static void exit(int status)
public static long currentTimeMillis()
pu...
Math类
Math类概述
成员变量
成员方法
应用
Random类
构造方法
成员方法
Math类
Math类概述
用于数学运算的类。掌握常用方法即可。
成员变量
注意 定义的方式(静态 常量 )
public static final double PI
public static final double E
System.out.println("PI:" + Math.PI);
System.out.println...
String类的概述和使用(掌握)
(1)概述
多个字符组成的一串数据。其实它可以和字符数组进行相互转换。
下图是解释一般String的存储方式。
(2)构造方法:
A:public String()
B:public String(byte[] bytes) // 这些[]都是数组
C:public String(byte[] bytes,int offset,int length)
D:public String(char[]...
1.单向队列:只能从头进,从尾出 2.双向队列:头尾都可以进出
<?php class duilie{ private $arr=array(); //从头进 public function Head_in($item){ return array_unshift($this->arr,$item); } //从头出 public function Head_out(){ return array_shift($this->arr); } //从尾进 public func...
<?php /*简单工厂模式初体验:通过传递特定类名来生产不同的对象的作用 class factory{ static function create($type){ return new $type; } } $obj=factory::create('mysql'); */
//DB引擎:传入不同的数据库类类名,通过类名直接调用该DB引擎中的方法 class DB{ public static $db; public static ...
<?php /*__clone()魔术方法: 1.当使用clone关键字clone对象时自动调用; 2.使用__clone()魔术方法是为了让新克隆的对象进行初始化重新赋值; 3.这个方法内部的$this代表的是新克隆的对象(副本); */ class person{ public $name; &nbs...