Java is an Objected-oriented programming language. It allows the feature for the developers “Write Once Run Anywhere” (WORA), it means that the code is compiled once will be able to run on every platform. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) in spite of any computer architecture. Java is most famous programming language for particularly client-server web applications and used by most of the programmers across the world. Java was originally developed by James Gosling at Sun Microsystems. And then it merged into Oracle Corporation and released in 1995 as a core component of Sun Microsystems’ Java platform. The language derives much of its syntax from C and C++.
The original and reference implementation Java compilers, virtual machines, and class libraries were originally released by Sun under proprietary licenses.
In the Java programming language, all source code is first written in plain text files and saved with the .java extension. These source files are then compiled into .class files by the javac compiler. As a platform-independent environment, the Java platform can be a bit slower than native code. The java launcher tool then runs your application with an instance of the Java Virtual Machine.
You’ve already been introduced to the Java Virtual Machine; it’s the base for the Java platform and is ported onto various hardware-based platforms. Through the Java VM, the same application is capable of running on multiple platforms.
An API is a large collection of ready-made software components that are capable of providing many useful capabilities. It is grouped into libraries of related classes and interfaces, and these libraries are known as packages.
Features of Java:
According to Sun Microsystems Java is very simple and easy to use language, because most of its syntax and features are derived from C & C++. So who are familiar with these two java is a easy cup of coffee for them. It removed many confusing & rarely-used features for example explicit pointers & operator overloading. It also provides feature of automatic Garbage collection.
Object-oriented programming (OOPs) is a technique to simplify software development and maintenance by providing some extra rules.
Basic concepts of OOPs are:
- Platform independent
It is based on ‘WORA’ feature once write and run anywhere.
It is secured because there is No explicit pointer (Programs run inside virtual machine sandbox).
Robust simply means strong. Java uses strong memory management, it lacks pointers that avoids security problem, and there is an automatic garbage collection there is exception handling and type checking mechanism.
We may carry the java bytecode to any platform.
- High Performance
Since byte code is “close” to native code slower than a compiled language (For example C++). So Java is faster than any other traditional interpretation.
We can create distributed applications in java. For this we can use RMI and EJB.
A thread is like a separate program, executing at the same time. The main advantage of multi-threading is that it shares the same memory. Threads are important for multi-media, Web applications etc.
Some other Features are:
- Architecture neutral
The Java Platform
A platform is the hardware or software environment in which a program runs. Some of the most popular platforms like Microsoft Windows, Linux, Solaris OS, and Mac OS.
Components of Java Platform:
- The Java Virtual Machine
- The Java Application Programming Interface (API)
Problems that may occur during compiling a program:
Error Messages on Microsoft Windows Systems
‘javac’ is not recognized as an internal or external command. If you receive this error, Windows cannot find the compiler (javac).
Error Messages on UNIX Systems
javac: Command not found
If you receive this error, UNIX cannot find the compiler, javac.
Syntax Errors (All Platforms)
If you mistype part of a program, the compiler may issue a syntax error. This error may be caused by omitting a semicolon (;) at the end of a statement:
In order to verify that your program is syntactically correct, the compiler checks for other basic correctness. E.g. the compiler warns you each time you use a variable that has not been initialized.
Install the Java Runtime Environment
First of all, we install the JRE in our system, in order to be able to execute. It is already mentioned that JRE is also included in the Java Development Kit.
Java Interview Question
What is the difference between the JDK, JRE and JVM?
JVM is an acronym for Java Virtual Machine, it is an abstract machine which provides the runtime environment in which java bytecode can be executed. It is a specification. JVMs are available for many hardware and software platforms (so JVM is platform dependent).
JRE stands for Java Runtime Environment. It is the implementation of JVM.
JDK is an acronym for Java Development Kit. It physically exists. It contains JRE + development tools.
How many types of memory areas are allocated by JVM?
Memory area allocated by JVM is many types please check the following.
- Class(Method) Area
- Program Counter Register
- Native Method Stack
What is JIT compiler?
JIT stand for Just-In-Time(JIT) compiler. In the Java programming language and environment, a just-in-time (JIT) compiler is a program that turns Java bytecode (a program that contains instructions that must be interpreted) into instructions that can be sent directly to the processor. After you’ve written a Java program, the source language statements are compiled by the Java compiler into byte code rather than into code that contains instructions that match a particular hardware platform’s processor
What does the “static” keyword mean?
Static keyword denotes that a member variable or method can be accessed, without requiring an instantiation of the class to which it belongs.
What is the platform in Java?
Platforms are used to run the program. These are two types of platforms a hardware platform and a software platform. Java is running into the software platform.
For More check out our lastest SEO Tutorials