- 博客(12)
- 收藏
- 关注
原创 vue ajax axios
加载html页面时自动触发vue——>vue挂载时自动触发异步请求,axios调用get方法,在回调函数中将data数据放到emps数据模型。
2023-06-20 21:29:53 45
原创 properties文件及其使用
Properties properties = new Properties(); properties.load(new FileReader("src\\mysql.properties")); properties.list(System.out); System.out.println(properties.getProperty("ip"));
2021-06-09 22:05:28 57
原创 IO流及其使用
大纲 文件流 创建文件方式: //方式一: String filePath = "e:\\news1.txt"; File file = new File(filePath); try{ file.creatNewFile(); }catch(IOException e){ e.printStackTrace(); } //方式二:new File(File parent ,String child) File parentFile = new File("e:\\"); String fi
2021-06-09 20:38:34 84
原创 常用类及其使用
包装类Wrapper 自动装箱和拆箱 装箱:int->Integer public class Wrapper { public static void main(String[] args) { int i =10; Integer integer = Integer.valueOf(i); System.out.println(integer); int m = integer.intValue(); S
2021-06-07 09:59:18 71
原创 异常exception error
atention: 编译时异常必须处理 对于运行时异常,如果没有处理,默认为throws的处理方式 子类重写父类方法时异常的规定:所抛出的类型要么和父类抛出异常类型一致,要么为父类异常类型的子类型 try-catch和throws二选一即可 自定义异常 ```java public class Test { public static void main(String[] args) { int age=20; if(!(age<10)){ ...
2021-06-07 00:35:35 109
原创 枚举类enumeration
public class Test { public static void main(String[] args) { System.out.println(SEASON.AUTUMN); } } //用enum代替class //类型之间用逗号隔开 enum SEASON{ SPRING("春天","warm"), SUMMER("夏天","hot"), AUTUMN("秋天","cool"), WINTER("冬天","cold");
2021-06-06 17:14:00 35
原创 内部类及其使用
类的五大成员:属性,方法,构造器,代码块,内部类 1.内部类 public class Factory { public static void main(String[] args) { Outer outer = new Outer(); outer.func(); } } class Outer{ private int n1=10; private void outer(){ System.out.println("
2021-06-06 11:46:07 195
原创 代码块codeblock使用
代码块语法: [static]{ //方法主体 } 代码块是对构造器的补充 静态代码块:对类初始化,随着类的加载而执行,只会执行一次 普通代码块:每次创建对象都会执行,和类是否加载无关 类什么时候会加载? 1.new对象时 2.创建子类对象时,父类会被加载,父类先被加载 3.使用类的静态成员(静态变量,静态方法) ...
2021-06-06 10:35:34 214
原创 Object类
object类包含的方法: //查看源码快捷键:ctrl+b 1.equals方法 equals和== == :基本类型时:判断基本类型值是否相等 == : 引用类型时:判断引用类型指向的对象的地址是否相等 equals方法 string重写equals方法:调用方法是直接比较值是否相等 public boolean equals(Object anObject) { if (this == anObject) { return true; } e
2021-06-06 00:05:38 37
原创 this关键字
this关键字以及多态 向上转型: animal可以调用属于animal的方法(需要遵守访问权限),但无法调用dog的方法 调用时符合就近原则。 //父类引用指向子类对象 Animal animal = new Dog(); 如果父类对象想使用子类对象的方法,就用到向下转型,此时编译类型和运行类型都是Dog Dog dog = (Dog) animal; 如果在强制转型的时候,转型的对象原本是猫,强转为狗,就会报错,为ClassCastException instanceof关键字: 用于判断对象的
2021-06-05 23:13:04 42
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人