Introduction to Java Programming Language :
Why do we need programming languages ?
Programming languages basically have syntax and they instruct the CPU to do a particular job. The CPU can understand only 0’s and 1’s. If we try to write something using 0’s and 1’s, it would be really difficult for any human beings to understand. So we came up with PYTHON, C, C++, JAVA etc.
How to they work ?
The languages like Python, C, C++ (High-level languages ) have software like compiler, interpreter according to the language. These software converts the high-level languages into machine-readable form(0’s and 1's).
What is compiler and interpreter?
Compiler takes the program written in high-level language as a whole and converts into machine-readable form but the interpreter takes a line and converts that line into machine-readable form (i.e) interpreter goes line by line whereas compiler takes the whole program.
Java Introduction :
Java was released in 1995. And it has been popular language since decades. One of the main reason for its popularity is PLATFORM INDEPENDENCE. Platform means operating system and architecture. Before Java, C/C++ runs on a particular platform and produces executable program for that platform only and that can’t be run in other platforms. That’s why integer datatype in c language takes 2 bytes/4bytes depending on the platform.
How does the java language differ from c/c++?
When the java program is compiled using a compiler, it generates an intermediate bytecode which is platform independent and is capable to run on any platforms. This has a preinstalled JVM (Java Virtual Machine).
Java Virtual Machine(JVM) is responsible for the conversion of high -level language into machine-readable form for that particular platform ( Machine-specific readable form ).
Some features of java:
6)Automatic Garbage Collector
7)No pointers are used here
8)There is no concept of operator overloading
First Program in Java :
A program in java is a collection of classes. Every function should be inside the class. The main() is the start of the execution of the program.
In the main method, “public” is the access specifier which says main method is accessible everywhere. “Static” is a special class which can be called without creating objects for it. “Void” is the return-type of the main function. Java decides it to be void. “String args” is the string array and has the parameter for the main class. Inside the main function, we have System.out.println(“Hello World!”) which prints the Hello World ! to the screen. “System” is the standard java class , “out” is the object of the printscreen class and “println” is the method of the printclass.
Leave your Feedbacks here email@example.com
Follow me on LinkedIn : https://www.linkedin.com/in/harini-ravichandran-2568a11a7/