学习guns自带的分页代码
https://blog.csdn.net/qq_47897078/article/details/120243801
关于构造器很详细的一篇文章
public Page() {
}
/**
* 分页构造函数
*
* @param current 当前页
* @param size 每页显示条数
*/
public Page(long current, long size) {
this(current, size, 0);
}
public Page(long current, long size, long total) {
this(current, size, total, true);
}
public Page(long current, long size, boolean isSearchCount) {
this(current, size, 0, isSearchCount);
}
public Page(long current, long size, long total, boolean isSearchCount) {
if (current > 1) {
this.current = current;
}
this.size = size;
this.total = total;
this.isSearchCount = isSearchCount;
}
一共出现了5个page
总结特点
1.构造函数的名称和类名一样
2.不用定义返回类型
3.不用return
4.参数不同的构造器(重载)
注:只有构造函数才能调用构造函数
用处
1.初始化实例(每次new个对象的时候都会调用构造方法)
2.用this、super(父类)调用