Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Introduction to Computer Programming with Java

In this article we will see an overview about computer programming using java

As we know that computer is an electronic device which is working on 0’s and 1’s. We commonly call this series (0’s & 1’s) as binary digits. The number 0 means that power OFF and the number 1 means that ON. And the most important thing in computer is, the computer stores the data and then starts process on it. We commonly use computer for calculations in offices, but now it becomes advanced because we can perform lot of jobs on it.

  • Designing
  • Gaming
  • Multimedia, etc

Hardware & Software:

Which computers are being used by us, they are in two parts Hardware and Software. The Hardware which can be touch or move by us, which is the physical shape of computers. And the Software is the instructions which are invisible to us. We can just use them by Computer’s Hardware. There are many parts of Computer, which are commonly known by CPU (Central Processing Unit), Memory, Floppy Disk, Monitor, Cache, Printer, and there are also some communication devices. Which are called Keyboard, Mouse, Joy Stick, Light Pen and also Printer, Scanner etc.

Computer Understand Languages:

As human being can understand their mother tongue and also some other languages, which they try to learn them from the surroundings as English, Russian, Espanola etc. Same like that Computer can understand the Machine Language, which is called binary digits language. Due to its complexity the Assembly language introduced which is called the low level language. Because we use words as a symbols for example Move AX,DX. In this example the AX and DX are registers and the Move is a keyword. It is easier to understand than the Machine Language. But it was also hard to program. That’s why the High level language was introduced. Which is so simple to understand due to its looks like English Language. If we write a simple program in Assembly Programming Language so we have to write multiple lines of code in Assembly Programming Language. For more details check the Listing 1. We use .asm extension to save the Assembly Programming Languages.

Listing 1: HelloWorld.asm

.MODEL SMALL
.STACK 0100H
.DATA
MESSAGE DB 0AH,0DH,'Hello World$'
.CODE
START:
        MOV AX,@DATA
        MOV DS,AX
        MOV DX,OFFSET MESSAGE
        MOV AH,09H
        INT 21H
        
        MOV AH,01H
        INT 21H
        
        MOV AH,04H
        INT 21H
END START   
Machine language (Binary Digits)

Figure 1: Machine language (Binary Digits)

Running the High Level Programming Languages:

We use commonly an application to run our programs which are programmed in High level programming Language. We call that application as compilers. There are many compilers for Java Programming Languages. There is a source file which contains all codes of the program. The compiler’s job is that to translate the source code in an executable code. The Java Programs usually compile’s in byte code, and the JVM which is Java Virtual Machine. It is an Interpreter which is used to interpret the Java source codes.

NOTE: we will use Eclipse for Java Programming as an IDE (integrated development environment). It has latest features and it’s the best option to use it for Java Programming.

Java Applets:

As we know that HTML is a Hyper Text Markup Language, it is used for static Web Pages. But we use <applet> tag for embedded the Java in HTML. Because Java is the Programming Language which has completely developed tools for dynamic websites. When we run the Java Programs using the browsers that are called Applets.

Java Programming & Keywords:

There are some words which can’t be use without their specific purpose. And when we use them, so compiler can understand them why we are using the keywords. There are many keywords as: class, static, void, public etc. And we should keep one thing in our minds during the Java programming, the source code of the Java Programs are case sensitive.

Executing the Java Programs Using Command Prompt:

We can also use the windows Command Prompt, to execute the Java Programs. Before we go to execute the Java Programs on CMD we should know the directory of the Java Programs. It is very simple to execute the Java Programs from their directories, if we create a folder in our C:/ drive which is commonly called the OS drive. Then we can access them easily from there.

Command Prompt Execution step by step:

So first of all lets we create a folder in the C:/ drive, and I am going to give it a name which is “Java Programming Course”. Then open your text editor as Notepad is built-in application, but you can also use Notepad++ for any kind of programming. One thing you should keep it in your mind when we are doing Java Programming so we will save its source file with the same as we used class name with .java extension. For more details read the listing 2.

Listing 2: helloworld.java

public class helloworld
{
public static void main(String[] args){
System.out.println("Hello World!!!");
}
}

Setting the Java Environment on Computer:

Let’s we download the latest SDK for Java Programming. After download the SDK we will install it. We will install the latest version of SDK in the C:/Program Files/Java directory.

Now we will set the Environment variables in this tutorial, I am going to tell you the method of windows 7. First of all we will go to the Start menu then control panel. In the Control Panel click on the System and then Advanced System Settings. You will see a new window and its name will be System Properties. Now click on Environment Variables there will be a new window and its name will be same as Environment Variables then there is option System Variables. Now search the path where we will past the path of the Java SDK which we installed now. The directory is C:\Program Files\Java\jdk1.7.0_25\bin.

Click on the path and then click on edit button you will see a new window which name is edit system variables. Go to the Variable value box first of check the end of the current path if there is a “;” so its ok if not so press the semi colon button and then past the directory of your SDK and then again press the semi colon. When you done so just press the OK button, it will be set the path which we want.

Execution on CMD:

Now let’s we first of all check the Java SDK version on cmd. Follow the following instruction one by one you will be able to understand. It is very easy if you have installed the SDK correctly and set the Environmental Variables. So you will be able to start Java Programming. And it’s very easy to Program using Java Programming.

  • Go to the CMD press window + R key
  • Then type here CMD and press OK, you will be in the CMD window
  • Now type cd\ and press Return( Enter) key
  • Then type java -version and press Return (Enter) key, you will see the latest version of the SDK which we currently installed.
  • Now go to the directory where we saved the source code of Java program, type cd Java Programming course and then press Return (Enter) key
  • Then type dir to check the directory of the Java Programming Course folder.
  • Then type javac HelloWorld.java and then press Return(Enter) key, if there is no any error so it will not show any thing.
  • Then type java HelloWorld and press Return(Enter) key, your First Java Program will be execute and it will display what we wrote in the source code.

NOTE: For more details check the Figure 2, you will understand it better. I have used the all steps in the Figure 2. Which I instructed you in the upper list step by step.

CMD Execution of Java Programs, step by step

Figure 2: CMD Execution of Java Programs, step by step

Conclusion:

In this tutorial we learnt that, basic introduction of the computer and also about the Languages. Which can be understand by the computer. It is very important for us to know the basic information about the Programming Languages. Java is a vast Programming Language, and if you want to be good in Java Programming so there are some conditions. You should know the basic information about the Computer process. How a Computer works and which languages it can be understand.

Then we learnt something about machine and low level programming languages. These both languages are too hard to understand by us, that’s why the High Level Programming language is invented. It is very easy to understand by us. If we compare the High Level Programming Language so it is fully similar as English. We also learnt about the Keywords, which are reserved words. We can’t use them by our purpose we can use them according to the rules of the High Level Programming.

If we compare the Listing 1 and Listing 2. So it is very easy to understand the Listing 2. Because we know what going to be happen now. But in the Listing 1, we can’t understand it fully which keyword is using for what.

What is their purpose in the program?

I also discussed the Applets which we can designed a web pages using Java programming and it will be a Dynamic Website. We will learn these all things in coming tutorials, so visit mrbool.com and learn my all coming tutorials about Java Programming. In which you will learn everything step by step. I hope you will be enjoyed to read my article on Mrbool.com.



Java and Android application developer with more than 3 years experience.

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login