Computer Science Module 1
Computer Science Module 1
CS 121
I Every language has its own set of syntax rules and semantics.
I Syntax rules – how we can put together symbols, reserved
words, and identifiers. (c = a + b)
I Semantics – rules that define what a program statement
means. (c = a + b means: add the variables a and b and
store the result in c)
I Think alphabet and grammar.
I A program will always do what we tell it to do, not what we
meant to tell it to do.
I Example: Lincoln.java
I Example: Lincoln2.java and Lincoln3.java
I Class header
I Class body
I Comments
I Method header
I Method body
I Identifiers
I White space
I Enough talk...
I Let’s just break it and see what happens.