Java notes Language info
For Loopsfor (int i = 1; i <= stop; i++){      //do something}
Create and Assign Variables String zipcode = “90210”; //the current zipcode is 90210
Increment Variablesint age = 38;age += 1;//also can incrementage++;
Conditionals - Ifint test = 0;if (test < 0){      //do something}
Conditionals – If / Elseint test = 0;if (test < 0){ //do something }else{ //do something else }
Create a Methodpublic static void doIt (String s ){    //do something}
Use a MethodString s = “hello”; doIt ( s );
To view a Value -- GettersGetPenColor ( );GetPenWidth ( );GetSpeed ( );
To Change a Value -- Setters SetPenColor (Colors.Reds.Red); SetPenWidth ( 5 ); SetX ( 10 );
Arraysint array [ ] = new int [ 1 ];int array [ ] = { “one” };array [ 1 ] = “one”;
Upcoming SlideShare
Loading in …5
×

TKP notes for Java

7,582 views

Published on

notes for teaching basic Java class

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,582
On SlideShare
0
From Embeds
0
Number of Embeds
6,390
Actions
Shares
0
Downloads
27
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

TKP notes for Java

  1. 1. Java notes Language info
  2. 2. For Loopsfor (int i = 1; i <= stop; i++){ //do something}
  3. 3. Create and Assign Variables String zipcode = “90210”; //the current zipcode is 90210
  4. 4. Increment Variablesint age = 38;age += 1;//also can incrementage++;
  5. 5. Conditionals - Ifint test = 0;if (test < 0){ //do something}
  6. 6. Conditionals – If / Elseint test = 0;if (test < 0){ //do something }else{ //do something else }
  7. 7. Create a Methodpublic static void doIt (String s ){ //do something}
  8. 8. Use a MethodString s = “hello”; doIt ( s );
  9. 9. To view a Value -- GettersGetPenColor ( );GetPenWidth ( );GetSpeed ( );
  10. 10. To Change a Value -- Setters SetPenColor (Colors.Reds.Red); SetPenWidth ( 5 ); SetX ( 10 );
  11. 11. Arraysint array [ ] = new int [ 1 ];int array [ ] = { “one” };array [ 1 ] = “one”;

×