COMP 14: Miscellaneous :) May 30, 2000 Nick Vallidis
Announcements zI made some changes to the P2 assignment (only on hand-in and grading policy) zoutput printout -- It's ok to put the word document on the disk and not print it
Review zWhat is control flow? zWhat are the two types of statements that modify the flow of control? How does an if statement work? if (condition) statement;
Review (cont.) How does an if-else statement work? What if we want to put more than one statement in an if or if-else ? if (condition) statement1; else statement2;
Replacement zWhat do I mean when I type something like ? yI mean that the whole string " " should be replaced by a variable name yExamples from your homework assignment: x" " turns into "Nick Vallidis" x" " turns into "May 30, 2000" zYou'll see other people do this...
Replacement zYou'll also see this done with italics zExamples: ycondition means use a boolean expression ystatement means replace with an actual Java statement
Indenting Don't forget the way indenting works with if, if-else, and block statements if : If (x > 255) System.out.println("x is a big 'un."); Indent here!
Indenting if-else : If (x > 255) System.out.println("x is a big 'un."); else System.out.println("x ain't so big."); Indents here!
Indenting zBlock statements: { System.out.println("x is a big 'un."); System.out.println("x ain't so big."); } Indents here!
Indenting zThis includes class definitions and main! Public class Birthday { public static void main(String[] args) { System.out.println("Hi!"); } Indents here! Two indents here because we're inside 2 block statements
Examples/Exercises zNo homework tonight! (unless of course you'd like to read ahead. I mean you don't have to, but it would probably be a good idea. Sure, everyone deserves a break sometime, but you should be all energized since you just had a long weekend. You should be ready to work your heart out this week. But, hey, it's up to you.)