In Eclipse, what is 'Enclosing type" when creating a class?

Jin Lee :

In Eclipse, when you are creating a class, there is a checkbox saying 'Enclosing type'. Does anyone know what it does? I have attached the screenshot.

enter image description here

user7294900 :

You can add a nested class using Enclosing type option

For example Class com.A, Add it as Enclosing type of new Class B

1

It will create a nested class B

public class A {

    private static class B {

    }

}

See more in Eclipse Help

Enclosing type Select this option to choose a type in which to enclose the new class.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=147391&siteId=1