上一页 1 ··· 7 8 9 10 11
摘要: String str = "abc"; char[] char[] char=str.toCharArray; //char→String char[] char = {'a','b','c'} String str = new String(char); byte[] byte[] byte = 阅读全文
posted @ 2021-12-02 16:06 Boerk 阅读(32) 评论(0) 推荐(0)
摘要: Vector是一个类似数组的容易,长度可以动态调整,存储的是对象(Obkect object) 创建 Vector vector = new Vector(); 存值 vector.addElement(Object object); //jdk5.0之前 int num = 1; Integer 阅读全文
posted @ 2021-12-02 14:27 Boerk 阅读(63) 评论(0) 推荐(0)
摘要: byte short int long float double char boolean Byte Short Integer Float Double Character Boolean 将基本数据类型转为包装类 int num =10; Integer i = new Integet(10); 阅读全文
posted @ 2021-12-01 12:28 Boerk 阅读(48) 评论(0) 推荐(0)
摘要: String s1 = "helloworld"; s1.length→字符串的长度 s1.isEmpty→return s1.length==0 s1.toLowerCase→小写 s1.toUpperCase→大写 s1.trim()→除去前置和后置空格 s1.equalIgnoreCase(s 阅读全文
posted @ 2021-12-01 11:27 Boerk 阅读(42) 评论(0) 推荐(0)
摘要: String s1 = "abc"; String s2 = "abc"; System.out.printIn(s1==s2); true. //常量池中不会存储连个想用的字符串,所以s1和s2都指向了常量池中相同的字符串,所以有相同的地址。 String s3 = new String("abc 阅读全文
posted @ 2021-11-30 16:58 Boerk 阅读(126) 评论(0) 推荐(0)
摘要: 抽象类通过abstract关键词定义。 *抽象方法必须在抽象类中 **抽象方法没有方法体,可以没有修饰符(可能是默认的) ***继承了抽象类的其他类必须对抽象方法进行重写。 ****抽象类不能被实例化(new) 接口通过interface定义(取代class) *方法是public abstract 阅读全文
posted @ 2021-11-26 10:04 Boerk 阅读(28) 评论(0) 推荐(0)
摘要: 学生类(Student)继承于(Extends)人类(Person) Student s1 = new Student(); Person s2 = new Student(); s1可以执行自己(Student)的所有方法,包括继承而来的。 s2不能执行Student独有的方法。 对象可以执行哪个 阅读全文
posted @ 2021-11-26 09:09 Boerk 阅读(19) 评论(0) 推荐(0)
摘要: A类是B类的父类,在B类中写"extends A" 因为A类是B类的父类所以可以用如下方法构建对象 B b = new A(); 使用b调用的是A类的方法。 //方法必须是非静态方法。static静态方法与类同时加载。 如果调用的是static方法,那么仍然走B类的方法。 阅读全文
posted @ 2021-11-24 11:33 Boerk 阅读(19) 评论(0) 推荐(0)
摘要: 创建 int arr[][] arrays = new arr[10][10]; 在一维的数组中嵌套另一个一维数组。 赋值 arrays[0][0]=1; arrays[0][0]=2; 同理。 调用 system.out.printIn(arrays[0][0]); 阅读全文
posted @ 2021-11-20 09:36 Boerk 阅读(20) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11