COMP 202 Lecture Notes - Lecture 3: Real Number, State Diagram, Floating Points
jc123 and 40170 others unlocked
100
COMP 202 Full Course Notes
Verified Note
100 documents
Document Summary
If you write an equation with an integer, java will return an integer. If you put a decimal, jave will not round to the nearest integer. ] Comp 202 lecture 3 variables, primitive data types, operators. [note on the last lecture: Why do we use variables: code readability, code generalisation, temporary storage for manipulation. [variables must be assigned before they can be used: declaration, initialistation, manipulation. Conventions for names (lowercamelcase): don"t start with $ Start with the lower case but then capitalise the first letter of each word inside the name of the variable. Short but not too short: name it something descriptive of its purpose and content, unique. Good eg. catname, tempf, hour, classcode. Bad eg. asfdstow, dateoftoday, urstupid, capitalsanywhere. Remember: java is case sensitive. You can declare multiple variales of the same type on one line. Variable declarations are statements they appear inside the method.