Chapter 3 – Conditionals more features and assignment

Chapter 3: Program Statements More Notes

While Statement:

whileLoopFC

while ( condition )
{
   // statements block
}

A common mistake: an infinite loop. The loop will keep going forever.

whileStatmt

The do loop:

doFC

do
{
   // statements block
}
while ( condition );

The for loop:

forStatement

forFlowChart

for ( initialization; condition; update )
    {
      // block statements
    }

It is a sign of unbelievably bad taste to put unrelated conditions into the loop. ( lol )

The switch statement

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

Class work:
Write a program HollePrinter_YI.java that switches the letters “e” and “o” in a string. Use the replace method repeatedly. Demonstrate that the string “Hello, World!” turns into “Holle, Werld!”