Introduction to JAVA
Java is one of the most powerful general-purpose object-oriented programming language. It is a simple, reliable, portable and powerful language.
Java is a strongly typed language.
Java was developed by James Gosling and his team at Sun Microsystems Inc in 1990s. In 2009, Oracle acquired Sun Microsystems and now more than 5.5 billion devices run Java.
The first official release for public of Java is java1.0 in 1995.
Java is supported on billions of devices across the globe at this moment. It is highly recommended for developing highly reliable, scalable, production-ready applications.
Important Components of Java:
- Java Compiler (aka JavaC)
- Java Virtual Machine (aka JVM)
- Java Runtime Environment (aka JRE)
Few types of applications supported by Java
- Desktop applications
- Web-based apps
- Mobile applications
- Distributed systems
- Cloud-based apps
- Big data
- Enterprise-level apps
- Gaming applications
- Embedded system
- Smart card
Features of Java
- Java is influenced from C and C++, so it includes many features of both the programming languages. Anyone who is familiar with C or C++ can easily learn Java.
- The concepts of C language like pointer, pre-processor, go to a statement are not supported in Java.
- The concepts of C++ language like operator overloading and template classes are not supported in Java.
- We can write Java source code on one platform (operating system) and Java allows us to run it on another platform without any alteration.
- Java code is not dependent on any machine as well as not dependent on OS.
- If changes are done at OS level, processor or any part of the computer then there is no need to change the source code.
- Java provides a byte code generated by the Java compiler that is not machine dependent i.e. it can be run on any Java enabled device without re-compiling.
- Java source written in Linux can be executed on Mac or Windows or any other Java enabled OS.
- Java is a purely object-oriented language.
- In Java, everything is within a class even the
main()function also resides in the class.
- In Java, everything is an object.
Basic OOP concepts
- In Java, everything is in class so one can reuse all the features of all classes whenever needed.
- With OOPs(Object oriented programming), we don’t need to rewrite the code again i.e reuse code with inheritance and other OOP concepts.
- If you’re familiar with C-styled coding structure then learning and development will be much Java quicker.
- The Java program can be easily move the from one device to another. The Java generates platform-independent byte-code that can be executed on any Java enabled platform that makes Java portable.
Compiled and Interpreted Language
- The programming language is either compiled or interpreted language but Java is both. It is compiled and interpreted.
- At the time of compilation, Java compiler converts source code into byte code.
- At the time of execution, Java interpreter take this byte code and it generates the machine code on which Java is running and gives the output respectively.
- Byte code is machine-independent.
- Multi-threading allow us to run more than one process simultaneously.
- Java allows this so there is no need to wait for one process to complete and then start the another.
- The multi-threading doesn’t occupy memory for each thread instead shares a common memory area. One such is popularly known as Heap space
- One can develop applications on the network using Java. Multiple programs at different remote locations can work together on a single project.
Robust and Secure
- Java is a robust language. Robust means strong because of strong memory management, does not support pointers that causes security problems.
- In Java, there is compile-time checking so it finds the mistakes early during development.
- During runtime errors can be handled with Exceptions.
- The Java garbage collector get rids of objects which are not being used by your application and free up space.
- In C++, the developer has to manually allocate and de-allocate memory objects. So, memory management issues are faced by developer if not managed well. There might be a possibility that developer frees the memory object which is still in use then it. But in Java it’s automatically managed with Garbage Collection .
Dynamic and Extensible
- Java is a dynamic language the linking data and methods, where they are located is done at runtime.
- Returning of a function is also allowed.
- Java also supports inclusion of new classes during the execution of the program.
Checkout our other blogs:
Hope you like this! If this article was helpful, share it.
Keep helping and happy 😄 coding