简单的分页小demo
public class Demo { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入总记录数"); int total = sc.nextInt(); System.out.println("请输入每页显示多少条数据"); int size = sc.nextInt(); int page = total % size == 0 ? total / size : total / size + 1 ; System.out.println("一共:"+page+"页"); } }