面试实战一:2019.10.17
发布日期:2021-05-14 17:52:40 浏览次数:19 分类:精选文章

本文共 1832 字,大约阅读时间需要 6 分钟。

2019.10.17??????????????????????????

??????????????Java????????

????

????????????????????????????????????

class Base {    int i = 99;    public static Base cloneX(int s) {        Super a = new Super();        System.out.println("Base, clone " + s);        return a;    }    Base() {        System.out.println("Create Base with " + i);    }}class Super extends Base {    int i = 1000;    public static void main(String[] args) {        Super super1 = (Super) cloneX(5);        System.out.println("i is " + super1.i);    }}

?????

  • ?????Super?????Super????????????
  • cloneX????????????????????Super???
  • ????

    ??SQL????????????????????????????????????????

    ????

    ???????????????????????????????DFS?????????BFS??????????????????????????

    ????

    ???????????????????????????????

  • ?tons???????????????
  • ???????????????????
  • ????????????????
  • ????????????????
  • ????????????????????
  • ???

    • ?????

      ?Component?????????Decorator???Component????????????????????

      interface Component {    void doSomething();}class Decorator implements Component {    Component component;    public Decorator(Component component) {        this.component = component;    }    public void doSomething() {        component.doSomething();        // ??????        System.out.println("Decorator???????");    }}class ConcreteDecorator extends Decorator {    public ConcreteDecorator(Component component) {        super(component);    }    public void doSomething() {        component.doSomething();        System.out.println("ConcreteDecorator???????");    }}

      ??????

      ???????????????????????????????

      interface Target {    void operate(Object obj);}class Adapter implements Target {    Source source;    public Adapter(Source source) {        this.source = source;    }    public void operate(Object obj) {        source.doSomething(obj);    }}

      ???Adapter???Source????????Target???????????????

    上一篇:Java后端技术栈梳理
    下一篇:数据请求结构和返回结构

    发表评论

    最新留言

    很好
    [***.229.124.182]2025年04月21日 08时51分30秒