This lab gives directions on using Netbeans, the development environment that we will use for this course. Netbeans is installed on the computers in the B12 computer lab and can be found in the start menu.
Netbeans is free and works on multiple operating systems. If you'd like to install it on your own computer, please see directions here.
With Netbeans, to write a program, you need to create a "project".
You should now see your program open. Netbeans fills in an empty class and main function. Feel free to delete the comments it gives you by default.
Netbeans includes highlighting of Java key words, and automatically indents for you. It will also prompt you in certain cases. For instance, if you type "System.", it will pull up a list of the options which are legal after that.
Write the following inside the main function:
Now we can run our program. Click the "Run Project" option under the "Run" menu. This can also be done by hitting the "F6" key by default.
You should see the output window at the bottom say "Hello world!" in it.
Sometimes, of course, there will be errors in our programs and the run will fail. To see this, try deleting the "}" line at the end of the program.
If you try to run it now, it will give you an error message.
You will need to fix the error in order to run the program.
To get credit for this lab, you should change the hello world program so that it prints "Hello" followed by your name.
Then email the .java file as an attachment to email@example.com. You will need to remember where on your computer you created the project to attach the file.
Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.