|
|
||
| 1. Why Java? |
|
|
|
||
|
|
||
| 2. The Basic Tools |
|
|
|
||
|
|
||
| 3. Java contexts |
|
|
|
||
|
|
||
| 5. discussion of hello world |
|
|
|
||
|
|
||
| 6. public static void main |
|
|
|
||
|
|
||
| 7. (String args[]) |
|
|
|
||
|
|
||
| 8. System.out.println("Hello World!!"); |
|
|
|
||
|
|
||
| 9. } // end main |
|
|
|
||
|
|
||
| 10. } // end class |
|
|
|
||
|
|
||
| 11. compiling |
|
|
|
||
|
|
||
| 12. running |
|
|
|
||
|
|
||
| 13. Hello world with command line input: |
|
|
|
||
|
|
||
| 14. how the parameter works... |
|
|
|
||
|
|
||
| 15. String concatenation |
|
|
|
||
|
|
||
| 16. using a condition |
|
|
|
||
|
|
||
| 17. Why a condition here? |
|
|
|
||
|
|
||
| 18. if statement |
|
|
|
||
|
|
||
| 19. conditions |
|
|
|
||
|
|
||
| 20. more on if statements |
|
|
|
||
|
|
||
| 21. if - else structure |
|
|
|
||
|
|
||
| 22. Simple GUI |
|
|
|
||
|
|
||
| 23. Demo of Simple GUI |
|
|
|
||
|
|
||
| 24. Adding components |
|
|
|
||
|
|
||
| 25. Demo of Components |
|
|
|
||
|
|
||
| 26. Event Handling |
|
|
|
||
|
|
||
| 27. Demo of Event Handler with shutdown button |
|
|
|
||
|
|
||
| 28. GUI input and output |
|
|
|
||
|
|
||
| 29. Demo of Simple I/0 |
|
|
|
||
//Hi
//Hello world on command line
public class Hi{
public static void main(String args[]){
System.out.println("Hello world!!");
} // end main
} // end Hi
//Hi
//Hello world on command line
public class Hi{
public static void main(String args[]){
System.out.println("Hello world!!");
System.out.println("...and a special hello to " + args[0]);
} // end main
} // end Hi
//Hi
//Hello world on command line
public class Hi{
public static void main(String args[]){
System.out.println("Hello world!!");
if (args.length >0){
System.out.println("...and a special hello to " + args[0]);
} // end if
} // end main
} // end Hi
if (condition){
...code...
...code...
...code...
} // end if
//Hi
//Hello world on command line
public class Hi{
public static void main(String args[]){
System.out.println("Hello world!!");
if (args.length >0){
System.out.println("...and a special hello to " + args[0]);
} else {
System.out.println("...Howdy, stranger!");
} // end if
} // end main
} // end Hi
//Hi with a GUI interface
import java.awt.*;
public class GuiHi1 extends Frame{
public static void main(String args[]){
GuiHi1 gh = new GuiHi1();
} // end main
GuiHi1(){
super("Hi");
this.show();
this.setSize(200,200);
}// end constructor
} // end class def
//Hi with a GUI interface
import java.awt.*;
public class GuiHi2 extends Frame{
public static void main(String args[]){
GuiHi2 gh = new GuiHi2();
} // end main
GuiHi2(){
super("Hi");
this.setLayout(new FlowLayout());
this.add(new Label("Hello there!"));
this.add(new Button("OK"));
this.show();
this.setSize(200,200);
}// end constructor
} // end class def