• 我想进阿里:通宵达旦三个月,学了这些技术点(附Java思维导图)


    前段时间学习沉淀了三个月,终于面试通过了阿里,原本就一直想着将自己积累的知识分享出去,这段时间由于公司的项目基本稳定,新项目的产品需求还没完全确定下来,所以就趁着这段时间整理了思维导图,分享下曾经的学习路线,以便有需要的人学习

    这次主要整理的有:

    1. 并发编程

    2. kafka

    3. spring

    4. mybatis

    附面试思维导图(仅供参考)

     

    并发编程:

    • 并发基础

    • 线程池

    • 原子操作

    • 内存模型

    • 线程通信

    • 其他

    • 并发集合

    • 并发工具类

    • synchronized

    Kafka:

    • kafka是什么

    • kafka特点

    • kafka历史

    • 安装

    • 使用

    • kafka常用场景

    • 常见消息队列

    • 架构

    jvm:

    • jvm调优

    • 内存相关

    • 内存结构

    • 对象

    • class文件结构

    • 垃圾收集

    • 类加载机制

    spring:

    spring测试

    生命周期

    IOC

    AOP

    mybatis:

    • 查询缓存

    • 高级映射

    • 应用知识结构图

    总结:

    我的学习笔记对于这些知识点都有详细的思维学习路线,除上述这几个专题的思维学习路线,还整理了有spring原理,微服务,Java集合等等专题的详细笔记。和大厂的面试整体以及解析

    java核心知识点pdf:

    大厂面试真题:

    简易图书管理系统

    1. 每本书数据【book】

    1. public class Book {
    2. }

    设置字段(书的属性)

    1. public class Book {
    2. private String name; //书名
    3. private String author; //作者
    4. private int price; //价格
    5. private String type; //类型
    6. private boolean isBorrowed;//是否被借出 默认false

    提供构造

    实例化对象,设置几个属性,因为字段是private修饰的就给每属性get set方法

    在加个构造和toString方法

    1. //构造
    2. public Book(String name, String author, int price, String type) {
    3. this.name = name;
    4. this.author = author;
    5. this.price = price;
    6. this.type = type;
    7. }

    get+set方法,便于操作数据

    1. //get+set
    2. public String getName() {
    3. return name;
    4. }
    5. public void setName(String name) {
    6. this.name = name;
    7. }
    8. public String getAuthor() {
    9. return author;
    10. }
    11. public void setAuthor(String author) {
    12. this.author = author;
    13. }
    14. public int getPrice() {
    15. return price;
    16. }
    17. public void setPrice(int price) {
    18. this.price = price;
    19. }
    20. public String getType() {
    21. return type;
    22. }
    23. public void setType(String type) {
    24. this.type = type;
    25. }
    26. public boolean isBorrowed() {
    27. return isBorrowed;
    28. }
    29. public void setBorrowed(boolean borrowed) {
    30. isBorrowed = borrowed;
    31. }

    重写toString方法,便于打印显示,(借出处略加修改)

    1. //toString
    2. @Override
    3. public String toString() {
    4. return "Book{" +
    5. "name='" + name + '\'' +
    6. ", author='" + author + '\'' +
    7. ", price=" + price +
    8. ", type='" + type + '\'' +
    9. ((isBorrowed==true)?"已经借出":"未借出") +
    10. '}';
    11. }

    2. 书架储存书【bookList】

    BookList类

    1. public class BookList{
    2. }

    设置书架大小

    1. //对多放十本
    2. private Book[] books = new Book[3];
    3. private int usedSize ; //实时记录 目前有几本书

    初始化书架,类构造方法

    1. public BookList() {
    2. books[0] = new Book("西游记","吴承恩",10,"小说");
    3. books[1] = new Book("三国演义","施耐庵",11,"小说");
    4. books[2] = new Book("红楼梦","曹雪芹",12,"小说");
    5. usedSize = 3;
    6. }

    getBook,拿出pos处的书

    1. //拿出pos处的书
    2. public Book getBook(int pos){
    3. return books[pos];
    4. }

    setBook,给pos下标放一本书

    1. // 给pos下标放一本书
    2. public void setBook(int pos, Book book){
    3. books[pos] = book;
    4. }

    getUesSize,setUesSize,获取实时书本数,用于修改

    1. //获取实时书本数,用于修改
    2. public int setUesSize(int size){
    3. return (usedSize = size);
    4. }
    5. public int getUesSize(){
    6. return this.usedSize;
    7. }

    3. 设置两个角色【user】

    管理员【AdmainUser】

    1. public class AdmainUser extends User{
    2. }

    构造方法,提供构造方法帮助父类构造

    1. //提供构造方法帮助父类构造
    2. public AdmainUser(String name) {
    3. super(name);
    4. //在new管理人员这个对象时,就把这些功能一并写入
    5. this.iOperations = new IOperation[]{
    6. new ExitOperation(),//0
    7. new FindOperation(),
    8. new AddOperation(),
    9. new DelOperation(),
    10. new DisplayOperation()
    11. };
    12. //设置一个开始菜单
    13. public int menu (){
    14. System.out.println("hello"+this.name+"欢迎使用BMS!");
    15. System.out.println("1.查找图书");
    16. System.out.println("2.增添图书");
    17. System.out.println("3.删除图书");
    18. System.out.println("4.显示图书");
    19. System.out.println("0.退出BNS");
    20. Scanner scanner = new Scanner(System.in);
    21. return scanner.nextInt();
    22. }

    普通用户【NormalUser】

    1. public class NormalUser extends User{
    2. }

    菜单【menu】

    1. //设置一个开始菜单
    2. public int menu (){
    3. System.out.println("hello"+this.name+"欢迎使用BMS!");
    4. System.out.println("1.查找图书");
    5. System.out.println("2.借阅图书");
    6. System.out.println("3.归还图书");
    7. System.out.println("0.退出BNS");
    8. Scanner scanner = new Scanner(System.in);
    9. return scanner.nextInt();
    10. }

    构造方法,提供构造方法帮助父类构造

    1. //提供构造方法帮助父类构造
    2. public NormalUser(String name) {
    3. super(name);
    4. //在new一般人员这个对象时,就把这些功能一并写入
    5. this.iOperations = new IOperation[]{
    6. new ExitOperation(),//0
    7. new FindOperation(),
    8. new BorrowOperation(),
    9. new ReturnOperation()
    10. };
    11. }

    4. 每个角色对应功能列表不一样

    身份不同,拥有的功能不一样

    管理员一般用户
    1.查找图书1.查找图书
    2.增添图书2.借阅图书
    3.删除图书3.归还图书
    4.显示图书
    0.退出BNS0.退出BNS

    5. 实现每一具体功能【operation】

    接口【interface】

    功能标准化【IOperation】

    1. public interface IOperation {
    2. //实现功能
    3. public abstract void work(BookList bookList);
    4. }

    增添图书【AddOperation】

    1. implements实现接口
    2. 录入书本信息
    3. 用getUesSize(),在书架的size位置插入这本书

    Tips:

    要先输入字符串String,再输入整数int!

    先输入整数再输字符串的话回车会被读进去

    1. package operation;
    2. import book.Book;
    3. import book.BookList;
    4. import java.util.Scanner;
    5. public class AddOperation implements IOperation{
    6. @Override
    7. public void work(BookList bookList) {
    8. System.out.println("添加图书!");
    9. Scanner scanner = new Scanner(System.in);
    10. System.out.println("请输入图书的名字");
    11. String name = scanner.nextLine();
    12. System.out.println("请输入图书的作者");
    13. String author = scanner.nextLine();
    14. System.out.println("请输入图书的类型");
    15. String type = scanner.nextLine();
    16. System.out.println("请输入图书的价格");
    17. int price = scanner.nextInt();
    18. Book newbook = new Book(name,author,price,type);
    19. bookList.setBook(bookList.getUesSize(),newbook);
    20. bookList.setUesSize(bookList.getUesSize()+1); //更新数量
    21. System.out.println("新增书记成功!");
    22. }
    23. }

    借阅图书【BorrowOperation】

    1. package operation;
    2. import book.Book;
    3. import book.BookList;
    4. import java.util.Scanner;
    5. public class BorrowOperation implements IOperation{
    6. @Override
    7. public void work(BookList bookList) {
    8. System.out.println("借出图书!");
    9. System.out.print("请输入借阅图书的名字:");
    10. int currentSize = bookList.getUesSize();
    11. Scanner scanner = new Scanner(System.in);
    12. String name = scanner.nextLine();
    13. for (int i = 0 ; i < currentSize; i++) {
    14. Book book = bookList.getBook(i);
    15. if (book.getName().equals(name)) {
    16. System.out.println("找到了!");
    17. book.setBorrowed(true); //改状态
    18. System.out.println("借阅成功!");
    19. return;
    20. }
    21. }
    22. System.out.println("没有这本书!");
    23. System.out.println();
    24. }
    25. }

    删除图书【DelOperation】

    1. package operation;
    2. import book.Book;
    3. import book.BookList;
    4. import java.util.Scanner;
    5. /**
    6. *覆盖
    7. */
    8. public class DelOperation implements IOperation{
    9. @Override
    10. public void work(BookList bookList) {
    11. System.out.println("删除图书!");
    12. System.out.print("请输入图书的名字:");
    13. int currentSize = bookList.getUesSize();
    14. Scanner scanner = new Scanner(System.in);
    15. String name = scanner.nextLine();
    16. int index = -1;//存下标
    17. int i = 0;
    18. for ( ; i < currentSize; i++) {
    19. Book book = bookList.getBook(i);
    20. if (book.getName().equals(name)) {
    21. System.out.println("找到了!");
    22. index = i;
    23. System.out.println(book);
    24. System.out.println();
    25. }
    26. }
    27. if (i >= currentSize) {
    28. System.out.println("找不到此书");
    29. return;
    30. }
    31. //直接覆盖
    32. for (int j = index; j < currentSize-1; i++) {
    33. bookList.setBook(j,bookList.getBook(j +1));
    34. }
    35. bookList.setUesSize(bookList.getUesSize()-1); //更新数量
    36. bookList.setBook(currentSize-1,null); //置为空 相当于free
    37. System.out.println("删除成功!");
    38. System.out.println();
    39. }
    40. }

    显示图书【DisplayOperation】

    1. package operation;
    2. import book.BookList;
    3. public class DisplayOperation implements IOperation{
    4. @Override
    5. public void work(BookList bookList) {
    6. System.out.println("显示图书!");
    7. int currentSize = bookList.getUesSize();
    8. for (int i = 0; i < currentSize; i++) {
    9. System.out.println(bookList.getBook(i));
    10. }
    11. System.out.println();
    12. }
    13. }

    归还图书【ReturnOperation】

    1. package operation;
    2. import book.Book;
    3. import book.BookList;
    4. import java.util.Scanner;
    5. public class ReturnOperation implements IOperation{
    6. @Override
    7. public void work(BookList bookList) {
    8. System.out.println("归还图书!");
    9. System.out.print("请输入归还图书的名字:");
    10. int currentSize = bookList.getUesSize();
    11. Scanner scanner = new Scanner(System.in);
    12. String name = scanner.nextLine();
    13. for (int i = 0 ; i < currentSize; i++) {
    14. Book book = bookList.getBook(i);
    15. if (book.getName().equals(name)) {
    16. System.out.println("找到了!");
    17. book.setBorrowed(true); //改状态
    18. System.out.println("归还成功!");
    19. return;
    20. }
    21. }
    22. System.out.println("没有这本书!");
    23. System.out.println();
    24. }
    25. }

    查找图书【FindOperation】

    1. package operation;
    2. import book.Book;
    3. import book.BookList;
    4. import java.util.Scanner;
    5. public class FindOperation implements IOperation{
    6. @Override
    7. public void work(BookList bookList) {
    8. System.out.print("请输入图书的名字:");
    9. int currentSize = bookList.getUesSize();
    10. Scanner scanner = new Scanner(System.in);
    11. String name = scanner.nextLine();
    12. for (int i = 0 ; i < currentSize; i++) {
    13. Book book = bookList.getBook(i);
    14. if (book.getName().equals(name)) {
    15. System.out.println("找到了!");
    16. System.out.println(book);
    17. System.out.println();
    18. return;
    19. }
    20. }
    21. System.out.println("没有这本书!");
    22. System.out.println();
    23. }
    24. }

    退出系统【ExitOperation】

    1. package operation;
    2. import book.BookList;
    3. public class ExitOperation implements IOperation{
    4. @Override
    5. public void work(BookList bookList) {
    6. System.out.println("退出系统!");
    7. System.exit(0); // 状态码 零代表正常结束,负数异常结束
    8. }
    9. }

    6. 主函数 【Main】

    整理所有功能

    1. import book.Book;
    2. import book.BookList;
    3. import user.AdmainUser;
    4. import user.NormalUser;
    5. import user.User;
    6. import java.util.Scanner;
    7. //登录
    8. public class Main {
    9. public static User login(){
    10. System.out.println("请输入你的姓名:");
    11. Scanner scanner = new Scanner(System.in);
    12. String name = scanner.nextLine();
    13. System.out.println("请输入你的身份: 1-->管理员,2-->普通用户");
    14. int choise = scanner.nextInt();
    15. if(choise == 1){
    16. return new AdmainUser(name);
    17. }else {
    18. return new NormalUser(name);
    19. }
    20. }
    21. public static void main(String[] args) {
    22. //整合!
    23. BookList bookList = new BookList();//准备图书
    24. //登录,
    25. User user = login();
    26. while(true) {
    27. int choise = user.menu();//父类的引用想访问子类的方法,此方法必须为抽象方法,动态绑定
    28. user.doOperator(choise, bookList);
    29. }
    30. }
    31. }

  • 相关阅读:
    前后端跨域请求问题解决方法
    JS语法杂记
    nginx配置详解
    ubuntu 20.04安装 Anaconda教程
    【智能家居入门1之环境信息监测】(STM32、ONENET云平台、微信小程序、HTTP协议)
    C语言的5个内存段你了解吗?( 代码段/数据段/栈/堆)
    6. Spring源码篇之FactoryBean
    Android网络监听
    Java-微服务-谷粒商城-1-环境搭建&项目初始化
    枚举(enum)/共用体(union)/结构体(struct)---详解
  • 原文地址:https://blog.csdn.net/Park33/article/details/126232557