AP Computer Science Java: Lesson 1.1b
Java Basics - Java Language Elements


Lesson 1.1b - Java Language Elements
Purpose: To learn some important ideas about the Java programming language

Language Elements All languages share the common elements of vocabulary, syntax and semantics. Let's define these for the Java programming language.

Vocabulary is the set of all words and symbols in the language. Examples in Java are the words public and class, as well as the symbols { and =.

Syntax consists of the rules for combining words into sentences, or statements as they are more usually called in programming languages. For example, in Java we use a semicolon to end a statement, and require the use of lowercase letters for keywords.

Semantics define the rules for interpreting the meaning of statements. As an example, the expression (x + 3) * 5.2 means go into the parentheses first and add 3 to x, followed by multiplying the result by 5.2.


In summary
,
the rules of any language are intended to create a logical system so that the language can be understood in the same way by all who use it. Java is no exception. When writing Java programs, pay close attention to the rules of the language. The computer will not understand you if you don't speak its language properly!

 

© DanShuster.com