3 main steps you need to know for programming blueJ

  1. -The instance variables are memory blocks used to store values (that you might use later). They can be numbers or letters, only one word (don't use the spacebar if two words are used for one variable, instead make the second word with a capital letter). The instance variables are either public ( everyone can see them) or private ( only you can see them). If they are numbers, then they can be integers (whole numbers) or doubles (1 = 1.0) ( I know there are many others but these are the basic ones)...

Examples: Private int 2

Public double 2

Private int myX

Public double myY

2. -The Consturctors initialize the instance variables. Letting you to give a value of the variables, or another name for them. They have specific types, such as void ( it means that the method has no return value. If the method returned an int you would write int instead of void ) or static ( it means that the method is associated with the class, not a specific instance variable of that class).

Example : public void X(int x){

myX = x;


The Example shown above tells the int "myX" to get the value of x, leading the user to make his own value of myX...

Example 2: public static draw(){

pencil. forward(100);


The Example shown above tells the pencil ( our drawing tool) to go forward 100, leading a straight line ( out of 100 pixels) meaning many Pixels at the same program... if the static is not used, and there are 2 " pencil.forward (100)"'s( which is prediction not proven) you will probably see only 1 line... I know it's confusing so there's another example with words ( not a code)...

If you have 2 squares ( Square 1 and Square 2) that are NOT static and you tell the program to display square 1, the program will display it with no problem, but if you tell it to display after that square 2, the program will erase square 1. (AGAIN this is a prediction).

3 The method is the one that you put your code here, in other words you make equations that support the idea of what you want to happen. The codes that already exist in the class (such as: System.out.print(), System.out.println() and many more...) are called a parameter. A Java method is a collection of statements that are grouped together to perform an operation. When you call the System.out.println() method, for example, the system actually executes several statements in order to display a message on the console.


public void getX(int y)


X= 2 *y;

System.out.print ( " the value of x is " + X);


This example let's the user to give a value of y ( must be a whole number because it's an integer) and getting the result of X which is 2 times y, is printed on the user's screen, by the parameter " System.out.print " , displaying on your computer "the value of x is X" ( the "+" sign is just a way of combining the sentence with a number).

P.S. Hey guys, I just made my account and I am really hoping someone find that introduction for Blue J, which is a Java-like program, helpful. I am really excited and if you have some questions, feel free to comment them down below, within a week they will be answered. And to be honest I am learning AP computer science in my school ( yes, I am only 15) and I struggled with blue J for a long time, and I know right now there is that one guy out there in internet where he struggles the same way I do and shouts for help... If at least 5 people follow me at night, than I will post the directions for the first code that you will be able to run on your own... And if we make it through the next year, I promise I will start C++ lessons.

<p>Thank you so much for the support... in about 3 hours I will show you common problems in Blue J and solutions for fixing them... :)</p>
<p>Great first Instructable. I actually didn't know about Blue J until I read this. Thanks for sharing the info. I hope you will share more of your projects in the future. </p>
<p>I forgot to say that I will make the text code on the image, on the next lesson bigger so people can read it... :) </p>

About This Instructable



More by titiman4:Variables & Expressions BlueJ problems Blue J introduction 
Add instructable to: