1

How to format java code automatically to add braces in eclispe

if (type == null) {
    if (other.type != null)
        return false;
} else if (!type.equals(other.type))
    return false;
Rpj
  • 5,348
  • 16
  • 62
  • 122

2 Answers2

1

To insert braces automatically you have to update the java editor in your preferences,

enter image description here

akash
  • 22,664
  • 11
  • 59
  • 87
0

You did not specify your OS , But generally following key combinations works to format code in eclipse :

Windows Os : CRTL + SHIFT + F

Mac Os : + + F

Hope this will help you.

Helping Hands
  • 5,292
  • 9
  • 60
  • 127