Skip to content

new SimpleFileVisitor<Path>() {} 大括号中的代码时立即执行的嘛 #33

@kungua

Description

@kungua

image
老师 匿名内部类中 new Class() {} 这样的写法 大括号中的代码

  1. 是立即执行的嘛?
  2. ....
    其实,我的问题应该是 Cat cat = new Cat() 这种写法很常见也很熟悉, 但是 Cat cat = new Cat() { //code } 这种写法有点晕

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions