JDK****关注的新特性
搭建学习环境
有用的新特性

Java Record


看看Record怎么用



Instance Methods


静态方法****Static Method


Record****的构造方法




Record与Lombok

Record****实现接口


Local Record


嵌套****Record


instanceof判断Record****类型






Switch

箭头表达式,新的case标签


yeild****返回值


java
public static void main(String[] args) {
int week = 1;
//yield 是 switch 的返回值, yield 跳出当前 switch 块
String memo = switch (week){
case 1 ->{
System.out.println("week=1 的 表达式部分");
yield "星期日,休息";
}
case 2,3,4,5,6 ->{
System.out.println("week=2,3,4,5,6 的 表达式部分");
yield "工作日";
}
case 7 -> {
System.out.println("week=7 的 表达式部分");
yield "星期六,休息";
}
default -> {
System.out.println("其他语句");
yield "无效日期";
}
};
System.out.println("week = " + memo);
}


Java Record



Text Block

认识文本块


文本块与普通的双引号字符串一样

java
public void fun1() {
String s1= """
lisi
""";
String s2 = """
lisi
""";
//比较字符串
boolean b1 = s1.equals(s2);
System.out.println("b1 = " + b1);
//使用 == 的比较
boolean b2 = s1 == s2;
System.out.println("b2 = " + b2);
String msg = """
hello world""";
//字符串方法 substring
String sub = msg.substring(0, 5);
System.out.println("sub = " + sub);
}

空白




文本块的方法

转义字符



var

var****声明局部变量


使用时候使用****var


sealed

Sealed Classes


java
//第一种 final
public final class Circle extends Shape {
}
//第二种 sealed class
public sealed class Square extends Shape permits RoundSquare {
@Override
public void draw() {
System.out.println("=======Square 图形======");
}
}
//密封类的子类的子类
public final class RoundSquare extends Square{
}
//非密封类 , 可以被扩展。放弃密封
public non-sealed class Rectangle extends Shape {
}
//继承非密封类
public class Line extends Rectangle{
}

Sealed Interface

Spring Boot


与Spring关系



与SpringCloud关系




最新的Spring Boot3新特性

如何学好框架

脚手架

使用脚手架创建项目



IDEA创建SpringBoot****项目

代码结构
单一模块



多个模块


包和主类

spring-boot-starter-parent


运行Spring Boot项目方式



starter




