摘要:
阅读全文
posted @ 2023-05-28 16:23
Karlshell
阅读(10)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2023-05-28 16:15
Karlshell
阅读(15)
评论(0)
推荐(0)
摘要:
package com.extendsDemo; public class Test { public static void main(String[] args) { B b=new B(); System.out.println(b.i); // System.out.println(b.j) 阅读全文
posted @ 2023-05-28 16:11
Karlshell
阅读(12)
评论(0)
推荐(0)
摘要:
package itheima; public class Test1 { //掌握懒汉式单例的写法 public static void main(String[] args) { B b1=B.getInstance();//第一次拿对象 B b2=B.getInstance(); System 阅读全文
posted @ 2023-05-28 15:54
Karlshell
阅读(14)
评论(0)
推荐(0)
摘要:
package itheima; /*什么是设计模式,设计模式主要学什么?单例模式解决的什么问题? *设计模式就是具体问题的最优解决方案 * 确保一个类只有一个对象 * * 单例是什么?饿汉式单例特点是什么? * 把类的构造器私有;定义一个类变量储存类的一个对象;提供一个类方法返回对象 * 在获取类 阅读全文
posted @ 2023-05-28 15:43
Karlshell
阅读(8)
评论(0)
推荐(0)
摘要:
package itheima; public class Test { public static void main(String[] args) { //认识两种代码块,了解他们的特点和基本作用 /**代码块是类的5大成分之一(成员变量、构造器、方法、代码块、内部类) * 静态代码块: * 格 阅读全文
posted @ 2023-05-28 15:22
Karlshell
阅读(45)
评论(0)
推荐(0)
摘要:
package itheima; public class Test { public static void main(String[] args) { //掌握使用类方法、实例方法时的几点注意事项 //1.类方法中可以直接访问类的成员,不可以直接访问实例成员 //2.实例方法中既可以直接访问类成 阅读全文
posted @ 2023-05-28 14:51
Karlshell
阅读(21)
评论(0)
推荐(0)
摘要:
package com.StaticDemo; public class Test2 { public static void main(String[] args) { //1.类方法的用法 //类名.类方法(推荐) Stndent1.printHelloWord(); //对象.类方法(不推荐) 阅读全文
posted @ 2023-05-28 14:29
Karlshell
阅读(101)
评论(0)
推荐(0)
摘要:
package com.StaticDemo; public class Test1 { public static void main(String[] args) { //通过案列理解变量类型的应用场景 User u1 =new User(); User u2 =new User(); User 阅读全文
posted @ 2023-05-28 14:16
Karlshell
阅读(68)
评论(0)
推荐(0)
摘要:
package com.StaticDemo; public class Student { //类变量也是静态变量 static String name; //实例变量 也叫对象变量 int age; } package com.StaticDemo; public class Test { pu 阅读全文
posted @ 2023-05-28 14:10
Karlshell
阅读(13)
评论(0)
推荐(0)

浙公网安备 33010602011771号