Last modified
Copyright © Cay S. Horstmann, Kathleen O’Brien 2009-2014
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
In all labs except this one, you will work in pairs. For this lab, you will each work on your own computer so everyone has the software installed.
Inside your documents folder, create a new folder called cs46a. (if you do not know how, ask your lab instructor)
Inside cs46a folder, create four new folders: labs, homework, exams, and pars.
Inside the homework folder create new folders called: hw01, hw02, and so on. Create hw01 now. You can create the others as you need them.
Inside the labs folder, create new folders called: lab01, lab02, and so on. Create lab01 now. You can create the others as you need them.
Your folder structure should look like this:
documents cs46a *homework --hw01 --hw02 *labs --lab01 *exams --exam1 *pars --par01
Sometimes in an attempt to be helpful, operating systems set options that can cause programmers a lot of trouble. There are different problems with different platforms. Here is the fix for a Windows problem.
File names are made up of two parts: a name and a file extension. The file extension is a . (dot) followed by 2, 3, 4 letters. Examples are .docx, .txt, .java. The file extension tells the operating system what application to use to open the file. Microsoft, in its questionable wisdom, hides the file extensions by default. This can cause you a lot of grief when you need to know the extension. So lets fix that!
HelloPrinter
rectangle. Erase all code in the editor window and paste in this code:
public class HelloPrinter { public static void main(String[] args) { // Display a greeting in the console window System.out.println("Hello, World!"); } }
void main(String[] args)
from the menu. Click OK on the next dialog. You should get this display:
Congratulations: Your development environment is set up and you have just executed your first Java program.
import java.util.Scanner; public class HelloPrinter { public static void main(String[] args) { // Display a greeting in the console window System.out.println("+---------------+"); System.out.println("| Hello, World! |"); System.out.println("+---------------+"); } }
Click Compile. Did it compile? If not, see if you can fix the error. If you can't figure out what is wrong, ask your lab instructors. That is what they are there for.
/downloads/HelloPrinter.signed.zip
.+---------------+ | Hello, World! | +---------------+