摘要: 1.方法的重载的概念 定义:在同一个类中,允许存在一个以上的同名方法,只要它们的参数个数或者参数类型不同即可。总结:"两同一不同":同一个类、相同方法名 参数列表不同:参数个数不同,参数类型不同 2.构成重载的举例: 举例一:Arrays类中重载的sort() / binarySearch();Pr 阅读全文
posted @ 2021-02-04 00:49 pilipalala 阅读(879) 评论(0) 推荐(0)
摘要: package day09; public class PhoneTest { public static void main(String[] args){ new Phone().price = 100;//匿名对象 new Phone().lookPrice();//输出0;匿名对象只能调用一 阅读全文
posted @ 2021-02-03 23:31 pilipalala 阅读(58) 评论(0) 推荐(0)
摘要: 1 package com.atguigu.exer; 2 3 public class StudentTest { 4 5 public static void main(String[] args){ 6 7 Student[] stud = new Student[20];//定义对象数组 8 阅读全文
posted @ 2021-02-02 21:05 pilipalala 阅读(73) 评论(0) 推荐(0)
摘要: 方法:描述类应该具有的功能 阅读全文
posted @ 2021-02-01 17:12 pilipalala 阅读(131) 评论(0) 推荐(0)
摘要: 属性(成员变量) vs 局部变量 阅读全文
posted @ 2021-02-01 15:36 pilipalala 阅读(89) 评论(0) 推荐(0)
摘要: * 1.创建类,设计类的成员 * 2.创建类的对象 * 3.通过“对象.属性”或“对象.方法”调用对象的结构 阅读全文
posted @ 2021-02-01 13:15 pilipalala 阅读(126) 评论(0) 推荐(0)
摘要: 2.空指针异常:NullPointerException 情况一: int[] arr1 = new int[]{1,2,3}; arr1 = null; System.out.println(arr1[0]); 情况二: int[][] arr2 = new int[4][]; System.ou 阅读全文
posted @ 2021-01-31 22:17 pilipalala 阅读(249) 评论(0) 推荐(0)
摘要: 数组角标越界异常:ArrayIndexOutOfBoundsException int[] arr = new int[]{1,2,3,4,5}; 情况一:i <= arr.length,导致角标越界。应改为i < arr.length; for(int i = 0;i <= arr.length; 阅读全文
posted @ 2021-01-31 22:11 pilipalala 阅读(225) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-01-31 21:41 pilipalala 阅读(52) 评论(0) 推荐(0)
摘要: package com.atguigu.java; import java.util.Arrays; public class ArrayTest { public static void main(String[] args){ //1.boolean equals(int[] a,int[] b 阅读全文
posted @ 2021-01-31 21:33 pilipalala 阅读(74) 评论(0) 推荐(0)