Hot Student Stories

Can java code be broken in different lines?

Jeffrey Rodriguez

in Studying

1 answer

1 answer

Roger Moore on July 23, 2020

Yes. The end of an instruction is specified by a semicolon; you do NOT by the end of the line. Therefore, each of the following are equivalent, and equally valid: x = y + z; x = y + z; x = y + z; But please, try to make the code readable. There really is no need to separate out a brief statement - as the example above - in several lines; but the instructions, which are wider than the screen can be divided, so that the programmer can read them without having to scroll sideways.

Add you answer