|
|
|
Learning is a pull not a push. |
|
Learning takes effort |
|
Learning complex subjects requires dedicated
brainpower |
|
|
|
|
|
|
Learn from an expert. |
|
- take a class |
|
- read the book they wrote. |
|
|
|
|
|
|
|
Typical website on HTML – 10 pages. |
|
Typical book on HTML – 200 pages. |
|
Indexed |
|
Ordered from basics to more complex stuff. |
|
|
|
|
|
|
|
|
Read a section to start setting up a mental framework. |
|
Try to use what you read. |
|
Read it again! |
|
Read a different book |
|
|
|
|
|
|
|
|
|
|
|
Learn by watching others |
|
Read the code they wrote |
|
Start with the basics |
|
- don’t jump in the deep end. |
|
Practice makes perfect |
|
|
|
|
|
|
|
|
|
|
if (x > 3) ; |
|
g.drawString("x is too big", 50,
50); |
|
|
|
|
|
|
// if (x>3) don’t do anything |
|
if (x > 3) ; // we don’t want this semicolon! |
|
// always write "x is too big" |
|
g.drawString("x is too big", 50, 50); |
|
|
|
|
|
|
// this is correct |
|
if (x > 3) |
|
g.drawString("x is too big", 50, 50); |
|
// using curly braces is safer |
|
if (x > 3) { |
|
g.drawString("x is too big", 50,
50); |
|
} |
|
|
|
|
|
|
// Loop forever because we never get |
|
// to the statement that changes x. |
|
while (x < 3) ; |
|
x = x +1; |
|
|
|
|
|
|
Remember the compiler ignores all white space,
so indentation is a convenience for us. |
|
|
|
while (x < 3) ; |
|
x = x +1; |
|
|
|
if (x > 3) ; |
|
g.drawString("x is too big", 100,
100); |
|
|
|
|
|
|
int counter = 0, x = 10; |
|
while ( counter < 8 ) { |
|
g.drawString("*", x, 20); |
|
x = x
+ 10; |
|
counter++; // counter =
counter + 1 |
|
} |
|
|
|
|
|
|
|
|
int counter = 0, x = 10; |
|
while ( counter < 8 ) { |
|
g.drawString("*", x, 20); |
|
x = x
+ 10; |
|
counter++; // counter =
counter + 1 |
|
} |
|
|
|
|
|