COMPSCI 2S03 Lecture Notes - Lecture 14: Object-Oriented Programming, Default Constructor
Document Summary
Types of java statements: sequential, selectional/conditional, loops/repetition, none of the above, all of the above. Identifiers: unique names given to class, variables, methods, constants. Identifiers are user defined names given to do something (declaration and initialization, using data types) Primitive data types, user defined data types, e. g. int x. Identifiers should not be keywords (reserved words that have special meaning in the programming language, e. g. while, for, do. However, scanner is not reserved, it"s a class name that can be redefined! Identifiers must start with letters, a-z, a-z, but can include numbers and underscores. Conditional statements - if this condition is true, the body will be executed. We can use break, continue to control the flow. Method calls to change the flow (jump to another method) Elementary data (single data), e. g. name, height, age. Class -> object (an instance of a class, called encapsulation) User defined classes: attributes (defined by properties) and methods (behaviours)