Lecture 01 - 01/18

Course About:

About Java Code:

  1. Every Java file must contain class declaration
  2. All code lives inside a class, including helper functions, global constants, ...
    • Exception: interfaces
  3. We define classes with "public class"
  4. To run Java program, typically define main method using:
    public static void main(String[] args)
  5. Statements end with semi-colons
  6. Instead of indentation, we use { and }
  7. Must declare variables before use
  8. Variables must have declared type, and that type is permanent
  9. Compiler checks that all types in program (variables, expressions) are comaptible before the program ever runs
    • Unlike Python, where type checks are done during execution
  10. Functions must be declared as part of a class in Java. Thus, all Java functions are methods.
  11. Define functions with "public static" (for now)
  12. All parameters of a function must have a type
  13. Functions must declare their return type
  14. Java functions only return one value

Reflections on Static Typing: