White Space
- Just as a book contains blank areas to separate sections of text (between paragraphs for example), so should a computer program.
- These blank areas are known as white space and are created with presses of the
, and keys. - Your code must have white space between components of the language, as in public void run instead of publicvoidrun, but Java itself ignores extra white space, with one exception we'll describe shortly.
- Good use of white space dramatically improves the readability of a computer program.
- Note the difference between
- int x,y;
- double sumOfScores;
- println("Please enter the scores: ");
- and
int x, y;
double sumOfScores;
println("Please enter the scores: ");
Both have exactly the same statements and the same effect but the second group is clearly much easier to read and understand because of the white space.
0 comments:
Post a Comment