Home » Online Computer Education » Learn Fundamentals of Java Programming “Introduction of Java” Lesson 1

Learn Fundamentals of Java Programming “Introduction of Java” Lesson 1

 

Introduction to Java

Welcome to “Fundamentals of Java Programming”! In this unit, you will learn to write and execute Java programs. But before you start writing one, it is important to know what a program is. A computer program is a sequence of instructions given to the computer in order to accomplish a specific task. The instructions tell the computer what to do and how to do it. Programming is the preparation and writing of programs for computers.

Programmers write their programs in a high level programming language such as Java, C++, Python, Ruby or Scala. However, as you are probably aware, a computer only understands its own language called “machine language”. Therefore, a compiler is needed to translate high level program code into machine language code that will be understood by the computer. After a program is compiled, the machine code can be executed on the computer, say Windows, for which it was compiled. If the program is to be executed on another platform, say Mac, the program will first have to be compiled for that platform and can then be executed.

Java is a very popular high level programming language and has been used widely to create various types of computer applications such as database applications, desktop applications, Web based applications, mobile applications, and games among others. A Java compiler instead of translating Java code to machine language code, translates it into Java Bytecode (a highly optimized set of instructions). When the bytecode (also called a Java class file) is to be run on a computer, a Java interpreter, called the Java Virtual Machine (JVM), translates the bytecode into machine code and then executes it. The advantage of such an approach is that once a programmer has compiled a Java program into bytecode, it can be run on any platform (say Windows, Linux, or Mac) as long as it has a JVM running on it. This makes Java programs platform independent and highly portable.

To write a Java program, you will need a Text Editor (for writing the code) and a Java compiler (for compiling the code into bytecode). There are a wide variety of Java Integrated Development Environments (IDEs) available in the market that come equipped with a text editor and a Java compiler and thus simplify writing, compiling and executing Java programs. Most of them are freely downloadable from the Internet. We will be using the open source and free Java NetBeans IDE for writing Java programs.

So let’s dive straight in and write a simple Java program that prints a Welcome Message (“Hello World”) on the screen. Since this will be your first Java program, you will first need to setup the programming environment (Refer to Appendix A for installation and starting NetBeans).

About

The main objective of this website is to provide quality study material to all students (from 1st to 12th class of any board) irrespective of their background as our motto is “Education for Everyone”. It is also a very good platform for teachers who want to share their valuable knowledge.

Leave a Reply

Your email address will not be published.