Before discussing the particulars, it is helpful to think of a computer program in terms of its structure and meaning simultaneously.
A Java program is structured in a specific manner. Java is a language and, therefore, has grammar similar to a spoken language, like
English
. Computer languages' grammar is usually much more straightforward than spoken languages but has the disadvantage of stricter rules. Applying this structure or grammar to the language is what allows the computer to understand the program and what it is supposed to do.
The overall program has a structure, but it is also essential to understand the purpose of part of that structure. By analogy, a textbook can be split into sections, chapters, paragraphs, sentences, and words (the system). Still, it is also necessary to understand the overall meaning of the words, sentences, and chapters to understand the textbook's content fully. You can think of this as the semantics of the program.
A line-by-line analysis of the program should give a better idea of both the structure and meaning of the classic “Hello World” program. Let’s take a look at it in the upcoming lessons.
I'm sharing more