What is Java
Java is a programming language. It is a computing platform that has its own Runtime Environment (JRE) and Application Programming Interface (API) to develop and run real world applications.
It is a simple, robust, platform independent, object oriented and user friendly language. Most of it’s syntax is inherited from C and C ++ programming languages. It also offers memory management and is a portable programming language.
It is based on the concept of “Write once, Run anywhere” .
Why should we use Java ?
Java provides many features as below :
1. Simple – Java is simple because most of it’s syntax is inherited from C and C++ programming languages. The syntax is user friendly, easy to remember and use. Also, several confusing features like pointers, operator overloading etc have been removed from it.
2. Platform Independent – Java runs on the concept of “Write once, Run anywhere” which means that we can develop our code on any environment (basically any operating system) and can run it on a different environment without any modification in the code.
Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms.
3. Architecture Neutral – Java code is architecture neutral which means the code is not dependent on any architecture (basically CPU, Registers and 32/64 bit platform). The code will work on any architecture.
4. Dynamic – Java has dynamic nature at run time. It loads class files, libraries at run time.
5. Object Oriented – Java is partially Object Oriented because it supports native data types like int, float, char etc. It provides object oriented features like :
6. Robust – Java programs are robust because of it’s capability to handle errors at run time, automatic garbage collection, Exception handling, type checking mechanism etc.
7. Secure – Java is secure because of following features :
- Java has it’s own virtual environment (Java Virtual Machine-JVM) to run programs.
- Resource allocation – Java verifies before allocating resources to any object. If it finds that the object is trying to access a resource which can harm the system , it simply denies the access which prevents damage from unknown objects.
- Classloader – It loads classes from network streams or from local system.
- Bytecode verifier – It verifies the syntax and code changes in class files generated after code compiles.
- Also, it doesn’t use the concept of pointers that avoids security problem.
8. Multi threaded – Java supports the concept of multi threading. We can develop our code in a way that multiple threads can access the same resources simultaneously. Memory is not occupied for each thread. The threads shares a common memory area.
9. Distributed – Java can be used to create distributed applications. It provides network facilities like I/O, Networking, Socket programming, multi threading and streaming.
10. Open Source – Java is open source and has wide community across the world.
Where Java can be used
Java is almost everywhere :
- Java can be used to develop mobile applications. Introduction to Android has made it even more popular than before. We don’t need to be an expert in Java to develop Android mobile applications. We can start with android from here – Android Studio
- Java can be used to develop dynamic web applications and enterprise applications. It provides JSP and Servlet to develop dynamic web applications. Now, we also have a lot of frameworks available in market which make development of web applications even more easier like Spring Framework, Spring Boot, Spring security, Spring for Web Services etc.
- Java is used in Set top boxes, Remotes, ATM machines, Satellites, Robotics and much more.