Java – Beginner

java beginner

Java Programming for Beginners:

The  Computer Program is a method that tells the computer when and what to do. Whatever happens from computer boot up to Shut Down is due to some program. MS-Word is a program, Norton Antivirus is a program, every command written on DOS Prompt is a program, even different types of Computer Viruses are a program.

Robots are an example of Artificial Intelligence today. These Robots are kept by rich people in their homes. These Robots are such that whatever work they are asked to do or they are told in some way, these Robots can do all the work very well. Like if you tell these Robots that when you have a Bell Ring in your house, they have to open the door of the house. So they do that. This is a simple example of a computer program in which you give some Instruction to an inanimate Robot, and that inanimate Robot obeys you and does the work you have been told.

Similarly, various types of Instructions are also provided to the Computer according to which the Computer works. As Microsoft Company has given the computer to the program by the Windows program that if a mouse moves, then the Cursor or Pointer on the monitor’s screen should also move in the same way. If someone clicks on the Start Button, then the Start Menu should be popup, etc.

 

We have on the Computer Action to her Response has already written Program to. When an Event occurs, the Computer starts working according to the program related to that Event and provides us our Required Result. Whatever happens in computer is called Event . like:

  • If we move the Mouse, then MouseMove Event Generate,
  • If we click with Mouse, MouseClick is Event Generate. In a similar way
  • If we do a Key Press on the Keyboard, then the Keypress Event Generate.

These are examples of Hardware Events . Software Events are also generated in the computer, which have been written to respond to various types of programs. for example:

  • Minimize a window,
  • Restore a window,
  • Close a window

Etc. are examples of Software Events . See the following program-

#include<stdio.h>
main()
{
printf("Hello World");
}

Through this program, we are providing an Instruction to our Computer to print on only one Message Screen. This program prints ” Hello World ” on the computer screen .
All the Coding Lines we write in a Computer Program , these lines are called Program Statements . The computer handles all those statements in a certain order, in the same way that a kitchen or a particular type of dish is followed to make a particular type of dish.

Since Computer works according to different Statements in the order in which a Programmer writes a Program. So if a program does not provide the result as a programmer wants, then it is not the fault of the computer but the Mistake of that program.

Most programs are written in the same way that we write a letter, in which we type every Word in a Word Processor. Some Programming Languages compilers come with their own Word Processors, such as Turbo C++‘s complete IDE of Program Creation, while some Compilers do not come with any Word Processor.

The Compilers No Word Processor comes with that can be Coding the Program, it may be that use of any other Word Processor to write Program’s Source Code. We can use all components of Java Developer Kit with any Word Processor such as Notepad or WordPad.

When the source codes of a program are written, then that source file has to be saved with the extension of that language. For example, if we write a program of “C” language using Notepad, while saving the file, we have to give .c extension after the name of the file . Similarly, if we save the program to Java, we have to use .java Extension after the file name . Such as Program.java, Application.java etc.

The programs we write are some common English words. But Computer understands only Binary Language. Therefore, we need a program that can convert our Source Codes into computer-understandable Machine Language.

An interpreter is a program that converts every line of any statement or code in the source file of any program into the machine language of the computer and tells the computer what to do. In some languages , using another software called Compiler , converts the Source Code File into Machine Language.

The only difference between these two is that the Interpreter converts every line or every statement of the source file into a computer-understandable Binary Language and if there is an error in a statement, it does not interpret further than that line or statement. Whereas Compiler is a program that converts the entire program into Machine Language simultaneously. If there is an error in the program, then the program displays all the errors simultaneously and does not convert the program to Machine Language until all the errors are debugged.

Programs that are Interpreted tend to run slower than Compiled Programs because the number of times such programs are run, they are converted to the machine language, while the programmed programs are converted to the machine language only once. Java is a language that needs both Interpreter and Compiler.

Whenever we write a program, there is always some kind of errors in it. These Errors are called Bug in the language of Computer Programming and Debug the process to correct these Errors . ( Basics of Java Programming for Beginners)