In Java when you use curly braces where should the right cur

In Java, when you use curly braces, where should the right curly brace be line up to (regardless of whether you use the Allman or K&R; styles)?

Solution

In java it\'s not a deal whether you put the right curly brace in the same line or new line i.e whether K&R style or Allman style. This both works, it is upto your decision where to put.

In general people will suggest mostly K&R style as it gives good look and also easy to understand. But if you are writing a large peace of code then Allman style will be usefull to understand.

But if you are writing JavaScript programs then it will be a difficult if you doesn\'t use K&R style. Because in JavaScript there is a concept automatic semicolon which means if you forget to put semicolon in any line it automatically put behalf of you. In this type of scenarios it will be a big mess if you write the semicolon in newline rather than in same line in required place.

Other than this it is not at all problem whether you use Allman or K&R style. The main important thing is how efficiently you wrote the code is the point.

 In Java, when you use curly braces, where should the right curly brace be line up to (regardless of whether you use the Allman or K&R; styles)?SolutionIn j

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site