1.具体见注释 2.后续或有更新 public class MyArray { private long[] array; private int cnt; // 自定义数组类的元素个数 /** 使用自定义类封装数组,添加类方法实现数据操作 */ public MyArray() { array = new long[50]; } public MyArray(int size) { array = new long[size]; } /** 插入数据,返回值为空 */ public void…
如果通过actions方法引用其他自定义类时 <?php class LoginController extends Controller { public function actionIndex() { $userModel = new UserMsg(); $this->render("index",array("userModel"=>$userModel)); } //以访法的形式在当前控制器里访问其他类 //这里主要用于访问验证码文件…
之前一直不是很理解为什么要重写HashCode和Equals方法,才只能作为键值存储在HashMap中.通过下文,可以一探究竟. 首先,如果我们直接用以下的Person类作为键,存入HashMap中,会发生发生什么情况呢? public class Person { private String id; public Person(String id) { this.id = id; } } import java.util.HashMap; public class Main { public…