I wanted to organise my class written in java. Currently i am using intellij and eclipse. Lot of fields variables and methods are there in my class. It looks lenghty. Is there any way to organise it.
Asked
Active
Viewed 226 times
0
-
2Are you sure your class *needs* all those fields and methods? Perhaps you should break it into multiple classes? When a class gets unwieldy to work with, that's *often* (but not always) a sign that it's doing too much. – Jon Skeet Apr 14 '15 at 06:28
2 Answers
0
There's no such equivalent to Java like C#. Some IDEs - Intellij, for instance, or Eclipse - can fold depending on the code types involved (constructors, imports etc.), but there's nothing quite like #region in Java
You can read up on more on Java equivalent to #region in c#

Community
- 1
- 1

Thusitha Thilina Dayaratne
- 5,666
- 4
- 42
- 69
0
In Netbeans you can use:
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
}
// </editor-fold>
In InteliJ:
//region GeneratedCode
private void initComponents() {
}
//endregion
And for eclipse check here: http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/editor/ref-preferences-folding.htm

Kiki
- 2,243
- 5
- 30
- 43