一、JVM的位置及体系结构 JVM作用在操作系统之上,而Java程序作用在jvm之上,其他的程序则与jvm并列二、类加载器,及双亲委派机制1.类加载器作用:加载Class文件->newStudent();实例的引用放在栈里,具体的对象放在堆里点击查看代码packagecom.Tang.jvm;publicclassCar{publicstaticvoidmain(String[]args){Carcar1=newCar();Carcar2=newCar();Carcar3=newCar();System.out.println(car1.hashCode());System.out.pr
一、概念1.内置注解(1)@Override重写注解加上此注解必须重写父类的方法(2)@SuppressWarnings("all")的作用除了上图可以放在方法名上,此外它还可以放到类名上用于镇压所有的警告(3)@Deprecated注解虽然是已经过时的,但是任然可以运行使用2.元注解(1)@Target注解target源码如下ElementType源码如下target表示该注解可以应用于哪些地方,比如下图value里只写了方法类型,该注解就只能用在方法名上,放在类名上就会报错,而当在value里添加了类的类型之后,该注解就可以应该用于类名上(2)@Retention注解Retention表示
每个方法使用见下方代码详解点击查看代码ArrayListlist=newArrayList();list.add("AA");list.add(123);list.add(newPerson("Tom",21));list.add(456);System.out.println(list);System.out.println("==================");//voidadd(intindex,Objectobj):在index位置插入obj元素list.add(1,"BB");System.out.println(list);System.out.println("======
一、Instant我们所处的时间点是在东八区,Java中Instant所计算出来的时间是按本初子午线的时间来算的,与我们的时间相差8个小时,也就是说当我的北京时间是上午九点时,本初子午线的时间是凌晨1点。点击查看代码@Testpublicvoidtest2(){//now():获取本初子午线的标准时间Instantinstant=Instant.now();System.out.println(instant);
详情解释请看下方代码区点击查看代码@Testpublicvoidtest1(){//实例化:now()获取当前日期、时间、日期+时间LocalDatelocalDate=LocalDate.now();LocalTimelocalTime=LocalTime.now();LocalDateTimelocalDateTime=LocalDateTime.now();System.out.println(localDate);System.out.println(localTime);System.out.println(localDateTime);//of():设置指定的年、月、日、时、分、秒
每个方法使用见下方代码详解点击查看代码ArrayListlist=newArrayList();list.add("AA");list.add(123);list.add(newPerson("Tom",21));list.add(456);System.out.println(list);System.out.println("==================");//voidadd(intindex,Objectobj):在index位置插入obj元素list.add(1,"BB");System.out.println(list);System.out.println("======
一、Instant我们所处的时间点是在东八区,Java中Instant所计算出来的时间是按本初子午线的时间来算的,与我们的时间相差8个小时,也就是说当我的北京时间是上午九点时,本初子午线的时间是凌晨1点。点击查看代码@Testpublicvoidtest2(){//now():获取本初子午线的标准时间Instantinstant=Instant.now();System.out.println(instant);
详情解释请看下方代码区点击查看代码@Testpublicvoidtest1(){//实例化:now()获取当前日期、时间、日期+时间LocalDatelocalDate=LocalDate.now();LocalTimelocalTime=LocalTime.now();LocalDateTimelocalDateTime=LocalDateTime.now();System.out.println(localDate);System.out.println(localTime);System.out.println(localDateTime);//of():设置指定的年、月、日、时、分、秒
1.Static详情见下面代码讲解点击查看代码packagecom.Tang.oop.demo07;publicclassStudent{privatestaticintage;//静态变量privatedoublescore;//非静态变量publicvoidrun(){go();//非静态方法可以调用静态方法}publicstaticvoidgo(){}publicstaticvoidmain(String[]args){Students1=newStudent();System.out.println(Student.age);//静态变量可以被类中的所有实例去共享//System.ou
1.Static详情见下面代码讲解点击查看代码packagecom.Tang.oop.demo07;publicclassStudent{privatestaticintage;//静态变量privatedoublescore;//非静态变量publicvoidrun(){go();//非静态方法可以调用静态方法}publicstaticvoidgo(){}publicstaticvoidmain(String[]args){Students1=newStudent();System.out.println(Student.age);//静态变量可以被类中的所有实例去共享//System.ou