Java Java Basics Perfecting the Prototype Parsing Integers

Michael Greig
Michael Greig
Front End Web Development Techdegree Student 9,694 Points

What're the rules around where you put your curly braces?

Hi there!

Just a quick one from the previous lesson...

Is it necessary to put a closing curly brace on a new line? Why is it not added at the end of the last line of code, like normal braces?

if (age<13) { //Insert exit code console.printf("Sorry you must be at least 13 to use this program. \n"); System.exit(0); }



1 Answer

Kourosh Raeen
Kourosh Raeen
23,728 Points

Hi Michael - Take a look at the Google Java Style Guide regarding braces: