我想在Eclipse中使用区域进行代码折叠;在Java中怎么做到呢?

c#中的一个例子:

#region name
//code
#endregion

当前回答

Jet Brains IDEA拥有这一功能。你可以使用热键环绕(ctrl + alt + T),这只是IDEA功能。

区域是这样的:

//region Description

Some code

//endregion

其他回答

在Visual Studio Code中,尝试这样做:

//region Variables
// Code you need
//endregion
#region

// code

#endregion

只有在IDE中才有好处。在Java中,IDE中没有固定的标准,因此实际上没有与#region并行的标准。

Android Studio(或IntelliJ IDEA)中最快的方法

突出显示要围绕它的代码 按CTRL + Alt + t 按c ==>输入描述 享受

与大多数人所发布的相反,这不是一个IDE的事情。这是语言问题。区域是一个c#语句。

Jet Brains IDEA拥有这一功能。你可以使用热键环绕(ctrl + alt + T),这只是IDEA功能。

区域是这样的:

//region Description

Some code

//endregion