Towson University COSC 236 Lab 1: Java Basics Lab document created by Kyung Eun Park
Introduction to DrJava DrJava is a programming environment for Java for beginners. For more detailed and technical user documentation, see the User Documentation: http://www.drjava.org
Using DrJava After installing, run DrJava under computer science/pgms folder Opening and Creating Files To create a new file, choose “File, New” from the File menu To open a file, choose “File, Open” from the File menu Saving Files To save a file, either click on the “Save” button or choose “File, Save.”
Saving Files
Compiling Files To compile all open files, click on the “Compile” button. Once the compile is completed, the results are displayed on the Compiler Output tab at the bottom of the screen.
Direction for Lab Assignments Submit your .java file before next Lab (11:00 a.m. February 4th) electronically on the BlackBoard. Make sure that your program contains your name, course, and section number as well as a brief description of the lab as a comment. The following slides include lab assignments for this week. Please write a complete Java program, compile, and run the program. The individual assignments can be combined into one program or you can submit them as a zip file.
Assignment 1 Write a complete Java program that prints the following output: ///////////////////////// || Vicotory is mine! || \\\\\\\\\\\\\\\\\\\\\\\\\
Assignment 2 Write a complete Java program that prints the following output: --------------- / ^ ^ \ (| @ |) \ \___/ /
Assignment 3 Write a complete Java program that prints the following output: A well-formed Java program has a main method with { and } braces. A System.out.println statement has ( and ) and usually a String that starts and ends with a “ character. (But we type \” instead!)
Assignment 4 Write a complete Java program that prints the following output: A ”quoted” String is ’much’ better if you learn the rules of ”escape sequence.” Also, ”” represents an empty String. Don’t forget: use \” (\’) instead of ” (’) ! ’’ is not the same as ”.
Assignment 5 Write a complete Java program that prints the following output: There’s one thing every coder must understand: The System.out.println command.