N
N
neverbethesameagain2020-05-28 19:32:26
Java
neverbethesameagain, 2020-05-28 19:32:26

How to properly place curly braces in Java?

ArrayList<Integer> list = new ArrayList<Integer>();
       for(int i=0; i<20; i++)
            if(i%2 == 0)
                list.add(i);


for(int i=0; i<20; i++){
           if(i%2 == 0){
               list.add(i);
           }
       }


From a technical point of view, there are no errors, because. everything starts in the first case, but what is the best way to put signs correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-05-28
@neverbethesameagain

The first option statistically causes more bugs, especially with changes to old code. Therefore, any styler will swear at him.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question