栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

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

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

我想进阿里:通宵达旦三个月,学了这些技术点(附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】
public class Book {
 }
设置字段(书的属性)
public class Book {
 
    private String name;     //书名
    private String author;   //作者
    private int price;       //价格
    private String type;     //类型
    private boolean isBorrowed;//是否被借出  默认false
提供构造

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

在加个构造和toString方法

//构造
    public Book(String name, String author, int price, String type) {
 
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }
get+set方法,便于操作数据
//get+set
    public String getName() {
 
        return name;
    }

    public void setName(String name) {
 
        this.name = name;
    }

    public String getAuthor() {
 
        return author;
    }

    public void setAuthor(String author) {
 
        this.author = author;
    }

    public int getPrice() {
 
        return price;
    }

    public void setPrice(int price) {
 
        this.price = price;
    }

    public String getType() {
 
        return type;
    }

    public void setType(String type) {
 
        this.type = type;
    }

    public boolean isBorrowed() {
 
        return isBorrowed;
    }

    public void setBorrowed(boolean borrowed) {
 
        isBorrowed = borrowed;
    }
重写toString方法,便于打印显示,(借出处略加修改)
//toString
    @Override
    public String toString() {
 
        return "Book{" +
                "name='" + name + ''' +
                ", author='" + author + ''' +
                ", price=" + price +
                ", type='" + type + ''' +
                ((isBorrowed==true)?"已经借出":"未借出") +
                '}';
    }
2. 书架储存书【bookList】 BookList类
public class BookList{
 }
设置书架大小
//对多放十本
    private Book[] books = new Book[3];
    private int usedSize ;  //实时记录 目前有几本书
初始化书架,类构造方法
public BookList() {
 
        books[0] = new Book("西游记","吴承恩",10,"小说");
        books[1] = new Book("三国演义","施耐庵",11,"小说");
        books[2] = new Book("红楼梦","曹雪芹",12,"小说");
        usedSize = 3;
    }
getBook,拿出pos处的书
//拿出pos处的书
    public Book getBook(int pos){
 
        return books[pos];
    }
setBook,给pos下标放一本书
// 给pos下标放一本书
    public void setBook(int pos, Book book){
 
        books[pos] = book;
    }
getUesSize,setUesSize,获取实时书本数,用于修改
//获取实时书本数,用于修改
    public int setUesSize(int size){
 
        return (usedSize = size);
    }
    public int getUesSize(){
 
        return this.usedSize;
    }
3. 设置两个角色【user】 管理员【AdmainUser】
public class AdmainUser extends User{
 }
构造方法,提供构造方法帮助父类构造
//提供构造方法帮助父类构造
    public AdmainUser(String name) {
 
        super(name);
        //在new管理人员这个对象时,就把这些功能一并写入
        this.iOperations = new IOperation[]{
 
                new ExitOperation(),//0
                new FindOperation(),
                new AddOperation(),
                new DelOperation(),
                new DisplayOperation()
        };
//设置一个开始菜单
    public int menu (){
 
        System.out.println("hello"+this.name+"欢迎使用BMS!");
        System.out.println("1.查找图书");
        System.out.println("2.增添图书");
        System.out.println("3.删除图书");
        System.out.println("4.显示图书");
        System.out.println("0.退出BNS");
        Scanner scanner = new Scanner(System.in);
        return scanner.nextInt();
    }
普通用户【NormalUser】
public class NormalUser extends User{
 }
菜单【menu】
//设置一个开始菜单
    public int menu (){
 
        System.out.println("hello"+this.name+"欢迎使用BMS!");

        System.out.println("1.查找图书");
        System.out.println("2.借阅图书");
        System.out.println("3.归还图书");
        System.out.println("0.退出BNS");
        Scanner scanner = new Scanner(System.in);
        return scanner.nextInt();
    }
构造方法,提供构造方法帮助父类构造
//提供构造方法帮助父类构造
    public NormalUser(String name) {
 
        super(name);
        //在new一般人员这个对象时,就把这些功能一并写入
        this.iOperations = new IOperation[]{
 
                new ExitOperation(),//0
                new FindOperation(),
                new BorrowOperation(),
                new ReturnOperation()
        };
    }
4. 每个角色对应功能列表不一样

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

管理员一般用户
1.查找图书1.查找图书
2.增添图书2.借阅图书
3.删除图书3.归还图书
4.显示图书
0.退出BNS0.退出BNS
5. 实现每一具体功能【operation】 接口【interface】 功能标准化【IOperation】
public interface IOperation {
 
    //实现功能
    public abstract void work(BookList bookList);
}
增添图书【AddOperation】
  1. implements实现接口
  2. 录入书本信息
  3. 用getUesSize(),在书架的size位置插入这本书

Tips:

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

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

package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation{
 
    @Override
    public void work(BookList bookList) {
 
        System.out.println("添加图书!");

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入图书的名字");
        String name = scanner.nextLine();

        System.out.println("请输入图书的作者");
        String author = scanner.nextLine();

        System.out.println("请输入图书的类型");
        String type = scanner.nextLine();

        System.out.println("请输入图书的价格");
        int price = scanner.nextInt();

        Book newbook = new Book(name,author,price,type);
        bookList.setBook(bookList.getUesSize(),newbook);
        bookList.setUesSize(bookList.getUesSize()+1);   //更新数量

        System.out.println("新增书记成功!");
    }
}
借阅图书【BorrowOperation】
package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class BorrowOperation implements IOperation{
 

    @Override
    public void work(BookList bookList) {
 
        System.out.println("借出图书!");

        System.out.print("请输入借阅图书的名字:");
        int currentSize = bookList.getUesSize();
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0 ; i < currentSize; i++) {
 
            Book book = bookList.getBook(i);
            if (book.getName().equals(name)) {
 
                System.out.println("找到了!");
                book.setBorrowed(true); //改状态
                System.out.println("借阅成功!");
                return;
            }
        }
        System.out.println("没有这本书!");
        System.out.println();
    }
}
删除图书【DelOperation】
package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;


public class DelOperation implements IOperation{
 
    @Override
    public void work(BookList bookList) {
 
        System.out.println("删除图书!");
        System.out.print("请输入图书的名字:");
        int currentSize = bookList.getUesSize();
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int index = -1;//存下标
        int i = 0;
        for ( ; i < currentSize; i++) {
 
            Book book = bookList.getBook(i);
            if (book.getName().equals(name)) {
 
                System.out.println("找到了!");
                index = i;
                System.out.println(book);
                System.out.println();
            }
        }
        if (i >= currentSize) {
 
            System.out.println("找不到此书");
            return;
        }
        //直接覆盖
        for (int j = index; j < currentSize-1; i++) {
 
            bookList.setBook(j,bookList.getBook(j +1));
        }
        bookList.setUesSize(bookList.getUesSize()-1);   //更新数量
        bookList.setBook(currentSize-1,null);  //置为空   相当于free
        System.out.println("删除成功!");
        System.out.println();
    }
}
显示图书【DisplayOperation】
package operation;

import book.BookList;

public class DisplayOperation implements IOperation{
 
    @Override
    public void work(BookList bookList) {
 
        System.out.println("显示图书!");
        int currentSize = bookList.getUesSize();
        for (int i = 0; i < currentSize; i++) {
 
            System.out.println(bookList.getBook(i));
        }
        System.out.println();
    }
}
归还图书【ReturnOperation】
package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOperation{
 
    @Override
    public void work(BookList bookList) {
 
        System.out.println("归还图书!");

        System.out.print("请输入归还图书的名字:");
        int currentSize = bookList.getUesSize();
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0 ; i < currentSize; i++) {
 
            Book book = bookList.getBook(i);
            if (book.getName().equals(name)) {
 
                System.out.println("找到了!");
                book.setBorrowed(true); //改状态
                System.out.println("归还成功!");
                return;
            }
        }
        System.out.println("没有这本书!");
        System.out.println();
    }
}
查找图书【FindOperation】
package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
 
    @Override
    public void work(BookList bookList) {
 
        System.out.print("请输入图书的名字:");
        int currentSize = bookList.getUesSize();
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0 ; i < currentSize; i++) {
 
            Book book = bookList.getBook(i);
            if (book.getName().equals(name)) {
 
                System.out.println("找到了!");
                System.out.println(book);
                System.out.println();
                return;
            }
        }
        System.out.println("没有这本书!");
        System.out.println();
    }
}
退出系统【ExitOperation】
package operation;

import book.BookList;

public class ExitOperation implements IOperation{
 
    @Override
    public void work(BookList bookList) {
 
        System.out.println("退出系统!");
        System.exit(0); // 状态码  零代表正常结束,负数异常结束
    }
}
6. 主函数 【Main】

整理所有功能

import book.Book;
import book.BookList;
import user.AdmainUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

//登录
public class Main {
 
    public static User login(){
 
        System.out.println("请输入你的姓名:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入你的身份: 1-->管理员,2-->普通用户");
        int choise = scanner.nextInt();
        if(choise == 1){
 
            return new AdmainUser(name);
        }else {
 
            return new NormalUser(name);
        }
    }
    public static void main(String[] args) {
 
        //整合!
        BookList bookList = new BookList();//准备图书
        //登录,
        User user = login();
        while(true) {
 
            int choise = user.menu();//父类的引用想访问子类的方法,此方法必须为抽象方法,动态绑定
            user.doOperator(choise, bookList);
        }
    }
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1039398.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号