In short, Java is the most popular programming language highly used everywhere from general to the scientific computer, static to a real-time system. Actually, Java can be defined as a platform and High level, robust, secured and Object-Oriented Programming Language. Why I said platform because Java has it’s own runtime environment, therefore it is called platform. Basically, there are two types of platforms, namely, software-based and hardware-based. Java provides a software-based platform.
History: Java was first developed by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan in 1991 at Sun Microsystem. It was initially called ‘oak’ but was renamed as Java in 1995.
Features of Java
Java is easy to write and understandable high level, object-oriented language. Java programmer doesn’t have to worry about pointer because Java provides manage memory explicitly. Java also eliminates operator overloading and multiple inheritances. In addition, It is always easier for programmers to learn it after c++.
Java is Object-Oriented:
Java is a fully object-oriented language which follows all the rules of OOPS like inheritance, abstraction, polymorphism, etc. and everything can be treated in the form of objects.
Compiled and Interpreted:
A computer language is either compiled or interpreted but Java combines both these approaches thus making Java a two-stage system.
Platform independent means that a program can run on any computer system. Java programs can run on any system for which a Java Virtual Machine (JVM) has been installed. JVM provides a runtime environment in which Java bytecode can be executed. This bytecode is a platform-independent code because it can be run on multiple platforms that is Write Once and Run Anywhere (WORA).
Java provides the facility of Automatic Garbage Collection which is run as a low-priority background thread, ensuring the high availability of memory, thus leading to better performance.
Java is a case sensitive programming language.
While executing the Java program, the user can get the required files dynamically from a local drive or from remote computer thousands of miles away from the user just by connecting with the Internet.
Java provides facilities to create a robust program, There is automatic garbage collection in Java. There are exception handling and type checking mechanism in Java. In addition, it checks code at compile-time and runs time. All these points make Java robust.
Java is secure because-
- No explicit pointer
- C++ uses runtime environment of Operating System while Java uses runtime environment of its own, Java program run inside Java Virtual Machine (JVM).
A thread is like a separate program, executing concurrently. Multi-threading means a single program having different threads executed independently at the same time. And Java supports multi-threading and provides the library for the Thread class. It allows Java programmers to write programs that perform many tasks concurrently.
Java is Faster:
Speed of Java programs is faster compared to other compiler-based languages such as C and C++.
Java code is portable it means Java programs can be easily moved from one computer to the other computer system. And Java bytecode can be executed on any machine that has the Java interpreter.
Scripting Language Support:
XML Processing and Web Services:
Java SE6 allows the development of Web services and clients that communicate using XML.
Java SE7 facilitates parallel programming through the use of the Fork/Join framework.
Some main applications of Java are:
- Desktop applications such as acrobat reader, media player, antivirus, etc.
- Web application
- Enterprise applications such as banking applications
- Mobile applications
- Smart Card
- Games etc.
How Java works:
In simple words, This story begins when you create Java source file and then you submit your Java source file to the compiler(Using command javac <source_file_name.java>). Here, the compiler starts finding errors in your code if the code is correct then your source file will execute correctly. And then compiler creates a new document coded into Java byte-code. You can find it in the same directory, it ends with .class extension. This file is actually platform-independent. And the story ends when the end-user uses Java Virtual Machine to read or run byte-code on his device. Basically, Java Virtual Machine (JVM) is a piece of software embedded into our devices to run the Java byte-code.
Introduction to First Java Program, Step by Step
Step 1. Open your notepad or code editor. Then write the following program
Step 2. Compile your code using the following command. Here command, “javac <sourceFile_name.java” is used to the compilation of your code.
after successful compilation of your code, you can see a new file having .class extension, This new file is called java bytecode.
Step 3. To run the program, use the following command “java <sourceFile_name>”. It will interpret the bytecode file to machine code.
Some words from the author’s keyboard
If this article was helpful to you please tell me in the comment section. In addition, if you have some suggestion regarding this article please email or comment. After that, I will consider your suggestion and take action on it. Thank you for scrolling my page. Sending Love from my keyboard 🙂