Skip to content
Advertisement

What is an acceptable way to format a long method call in Java? [closed]

Is it good style to write:

JavaScript

(which is obviously far to long for one line) as

JavaScript

Another way would be:

JavaScript

Advertisement

Answer

If you’re working with others, or in a pre-existing code base, use whatever standards they’ve already been using. 80 vs 100 column, option #1/2/3, etc.

If you’re working on your own, Jordi’s answer nails it. Use the Oracle conventions, and likely go with 100 character line lengths; we have modern screens that fit a lot, lot more text than monitors did in 1996.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement