Skip to content

Latest commit

 

History

History

week2-expressions-conditionals-loops

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

week 2

Welcome to week 2 of Java 1.

Some notes on the videos

  1. What was shown in the videos is not idiomatic java. Write curly braces on the same line as ifs and elses. Java is open source and you look at the source code for "String" if you want to see the common style.
  2. Spaces vs tabs comes down to where you work and who you work with
  3. The only rule of spaces vs tabs is don't mix spaces + tabs in the same file. It really makes things hard to read.
  4. Generally web developers (such as JavaScript people) prefer spaces. Spaces look better on GitHub!
  5. Generally, it seems that Java developers seem to use tabs, I think this is just due to IDE defaults.
  6. As with many things in life, readability is ultimately subjective. Read a lot of code and form your own opinions.

Agenda

  1. Welcome
  2. Recap last week:
  3. what is java
  4. what are datatypes
  5. how are your editors working?
  6. Homework Review
  7. review assignment one a
  8. review assignment one b
  9. review assignment two
  10. Reading in data.
  11. Using Scanner with System.in (nextInt() and nextLine())
  12. Boolean expressions
  13. 1 == 1
  14. 1 == 2
  15. var1 == var2
  16. string1.equals(string2)
  17. Integer == Integer ???
  18. always use .equals for objects.
  19. how does .equals work?
  20. The rest: !=, <, >, >=, <=
  21. Logical Operators
  22. && and ||
  23. Conditionals
  24. if
  25. if else
  26. if elseif else
  27. switch case
  28. nest an if in another if
  29. break a program early (System.exit() - exit process, or return; early - even in void)
  30. Scope inside of if blocks
  31. what is Scope
  32. when does scope change
  33. what is a block of code?
  34. for loops
  35. components of a for loop
  36. how does scope work?
  37. While loops
  38. How do they differ from a for loop?
  39. How to break early?