Reputation: 1657
When I format my code in Eclipse, my array initializer goes from:
int[] array = {1, 2, 3};
to:
int[] array =
{1, 2, 3};
Why is the {1, 2, 3};
on a new line instead of the same line as the array declaration after formatting?
How do I fix this so that the {1, 2, 3}
stays on the same line as the int[]
array after formatting?
Would you help me?
Upvotes: 0
Views: 625
Reputation: 705
Go to Window > Preferences > Java > Formatter > Edit active profile > Braces and change Array initializer from "Next line" to "Same line"
Upvotes: 4