|
Create a project and Class with BlueJ
Hello World, BlueJ Style
The only assumptions that this tutorial makes is that a student has some sense of what a class is as well as what System.out.println() method does.
How to Create a Project
- 1) After opening up BlueJ, select 'new project.' Let's call our first BlueJ project "FirstProject".
- 2)
Your screen should now look like this picture. The blank document with the turned corner represents the project:
How to Create a Class in a Project
Running our first BlueJ Class
- To run the class, just right click on the HelloWorld icon and select 'new HelloWorld()'
-
There will be a prompt asking you for the instance name. You can use whatever you want here. If you've used Jeroo this is the same as the name of the Jeroo. You can use any valid identifier (an identifier can't have spaces and can't start with a number
//tom is the instance name of this Jeroo
Jeroo tom = new
Jeroo(1,2);
-
Finally, our first BlueJ class has been compiled and run. You should see the output that is pictured below
Mini Programming Assignment
There are many ways to solve this problem. Below shows how you can employ code reuse and constructor overloading to come up with a nice solution.
See solution in its own window
|