Java is a most widely used server side object oriented programming language.
Features of Java
- Simple:
- User friendly syntax based on C++
- It has Automatic Garbage Collection
- It has Rich set of APIs
- Removed confusing features – explicit pointers, operator overloading, multiple inheritance, etc
- Object-oriented:
- In Java, we organize the software as a combination of different types of objects that incorporates both data and behaviour.
- Based on the concept of Objects, Class, Inheritance, Polymorphism, Abstraction, Encapsulation
- Platform Independent:
- Java provides software-based platform. It has two components:
- JRE (Runtime Environment)
- API (Application Programming Interface)
- Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent. Can run on many platforms – Windows, Linux, Mac, etc.
- Java provides software-based platform. It has two components:
- Secured:
- No explicit pointer
- JVM – java Programs run inside virtual machine sandbox
- Classloader – adds security by separating the package for the classes of the local file system from those that are imported from network sources.
- Bytecode Verifier – checks the code fragments for illegal code that can violate access right to objects.
- Security Manager – determines what resources a class can access such as reading and writing to the local disk.
- More – developers can add extra security through SSL, JAAS, Cryptography etc.
- Robust:
- Good memory management – automatic garbage collection.
- No pointers – increses security.
- Exception handling – increses robustness against errors.
- Strongly typed – every variable must be declared with a data type.
- Statically typed – type checking of variables is performed at compile time.
- Architecture-Neutral:
- There is no implementation dependent features. e.g. size of primitive types is fixed.
- Portable:
- Write Once and Run Anywhere.
- Interpreted:
- Java is compiled to bytecodes, which are interpreted by a Java run-time environment.
- The interpreter reads bytecode stream then execute the instructions.
- High-Performance:
- Uses ByteCode
- Just-In-Time (JIT)
- Garbage collector
- Distributed:
- We can create distributed applications in java. RMI and EJB are used for creating distributed applications.
- We may access files by calling the methods from any machine on the internet.
- Multi-threaded:
- A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads.
- The main advantage of multi-threading is that it doesn’t occupy memory for each thread. It shares a common memory area.
- Threads are important for multi-media, Web applications etc.
- Dynamic:
- Dynamic Compilation (JIT) – Implementations to gain performance during program execution. The machine code emitted by a dynamic compiler is constructed and optimized at program runtime, the use of dynamic compilation enables optimizations for efficiency.
- Load on Demand – Loads in classes as they are needed, even from across the network.
- Dynamic memory allocation – All Java objects are dynamically allocated.
- Dynamic Polymorphism – Compiler doesn’t know which method to be called in advance. JVM decides which method to called at run time.
Core Java Tutorials
- Run Java program from command line
- Difference between println() and print() in Java
- Java comments best practices
- Types of variables in Java with Examples
- Java Keywords with Examples
Java Sorting Programs
- Bubble Sort Java Program Logic
- Insertion Sort Java Program Logic
- Merge Sort Java Program Logic
- Quick Sort Java Program Logic
- Radix Sort Java Program Logic
- Selection Sort Java Program Logic
- Heap Sort Java Program Logic
- Counting Sort Java Program Logic