Java – Introduction to Computer Program
Java is a computer programming language to write the computer program. Basically, the computer follows a list of instructions for performing tasks. This list of instructions is a computer program.
The instructions include 2 things:
- List of ingredients (called variables).
- List of directions (called statements/commands) that define what to do with the variables.
The working of computers solely depends on these computer programs. The Central Processing Unit or CPU controls the execution of programs. Hence it is the brain of the computer.
How to write a computer program? Programming Languages
There are 3 types of programming languages depending upon the factor “ease of understanding” by the computer and the users.
Machine Language (Binary Language):
This is the first type of programming language developed and is of the lowest level. Computers understand binary language consisting of only 0’s and 1’s in patterns like 001100110…
The translators translate the source code written in any programming language other than machine language into binary codes. The computer is then able to follow the instructions. This language is directly interpreted into the hardware.
This is another low-level language. In this, operation codes and operands are written in the form of alphanumeric symbols known as mnemonic codes. There is no binary, with 0’s and 1’s. These mnemonic codes can combine in a 5 letter combination like ADD, SUB, START, MUL, etc.
Since Assembly level languages use symbols to write programs, we call it Symbolic Programming Language. They are relatively easier to understand. Error correction is also easier as compared to machine level languages.
High-level computer language like C, C++, Java uses English words and mathematical symbols to write the programs. Unlike assembly language, they do not use mnemonic codes.
These languages make programming easy to understand, learn, maintain through the use of a user-friendly language environment. In order to make a computer understand higher-level languages, you need to use a translator.
Types of High-Level Programming Language:
High Level of programming languages can be broadly divided into 3 types based on the programming paradigm:
Procedural Programming Languages:
The languages follow an ordered way of executing statements of a program to perform a computational task. It is also known as imperative programming. The programs consist of a number of procedures that are read and executed sequentially modifying a shared memory.
For example – Fortran, COBOL
Functional Programming Languages:
This programming approach focuses on creating functions to solve the problem. It uses expressions rather than describing through statements. The translators evaluate the functions just like mathematical expressions to produce a value.
It basically comes under declarative programming which prioritizes the “logic to solve” rather than the “order to execute”.
This programming language totally focuses on objects instead of procedures or functions. Objects are “data” along with information. This information includes the operations we can perform on the data, accessibility of data to the external environment and their interaction with other objects. This method of focusing on the data which we can manipulate has become one of the most powerful programming approaches.
For example C++, Java
Let us now proceed and move towards exploring Java in details. We will start from a brief overview of how it started, its application and features and then move to write programs.
- You should know how to use a computer and should be able to start a command line shell.
- If you already know C++ or any other Object-Oriented language, Java would be easy to pick up and learn. The concepts of C++ are very much similar and so is the syntax to write a program.
Even if you are new to programming, this is the right place to start with. This tutorial will explain in details all the syntax needed to write a program in Java, the inbuilt methods and how to make use of them.