Monday, January 3, 2022

1. Java Features

1.  Java - Features

All these features are explained here - 



Object Oriented Programming Language 

Everything we write in java always revolves around objects. That is why it is called as object oriented programming language. 

Without writing at least one class we cannot write java application. 

Software that is implemented in java is organized into different types of objects. 

Basic Concepts of OOPs are 

  • Objects 

  • Classes 

  • Encapsulation 

  • Inheritance 

  • Polymorphism 

  • Abstraction 

However, C language is called procedure oriented programming language. 

Simple 

Java is easy to learn and its syntax is based on C++. 

Java has removed complicated and rarely used C++ features like operator overloading, pointers, manual memory allocation and de-allocation 

Platform Independent 

Java is platform independent which is different from other languages like C and C++. C and C++ are the platform dependent languages. Applications written in C and C++ and compiled in one platform cannot be executed directly on another platform. It needs recompile on the new platform before execution. 

(OS and processor combination is called as a platform) 

Java code can be run on multiple platforms like windows, linux, Mac OS etc. Java code compiled by the java compiler and converts it into the byte code. 

When we execute this byte code in another platform then it will be converted into that platform specific instruction and then executes. That is why java code is platform independent. 

Its called as Write Once Run anywhere. 

 

Distributed 

Java is distributed because it has facility to create distributed applications using RMI and EJB in java. 

Java also supports socket programming to interact with systems present in network using TCP/IP and UDP protocols. 

Robust 

Java is robust because it uses strong memory management and automated garbage collection, exception handling and type checking. 

Secure 

Java is secured programming because 

  1. Java programs run inside a Java Virtual Machine(JVM) Sandbox 

  1. Bytecode Verifier – It checks the code fragments for illegal code that can violate the access rights to the object 

  1. Classloader – In java, Class loader is used to load java classes into JVM dynamically. It creates separates package for the classes that are imported from network sources and for the local file system classes. 

  1. Security manager – to check whether the program has access rights to local system resources. 

COMPILED and INTERPRETED 

Once the program is compiled into byte code it will be given to JVM. JVM has an interpreter to interpret the byte code and it also has the JIT compiler to speed up the execution. 

That is why java is called as both compiled and interpreted language. 

PORTABLE 

When java program is compiled into byte code, it can be ported easily to any platform without any changes. 

 

HIGH PERFORMANCE 

Java applications provides high performance when compared to interpreted programming languages.  

because  

its byte code is close to native code 

JIT(JUST-IN-TIME-COMPILER) comes into picture in execution along with interpreter to execute some instructions directly on to processor. 

Java is still a little bit slower than compiled languages like C, C++. 

 

MULTI THREADED 

A thread represents a separate path of execution for group of instructions.  

Multiple tasks can be executed concurrently by creating thread for each task. 

When we want to do multiple tasks at the same time, then java facilitates us to write multi threaded applications. Application don’t have to wait for one task to complete, in order to start another task. 

SCALABILITY 

It can run on wide variety of devices starting from less memory embedded devices to large mainframe systems. 

DYNAMIC 

Any programming language is called as dynamic if its behavior changes dynamically. 

Java supports loading of classes dynamically on demand 

Java supports dynamic polymorphism that the behavior will change based on the runtime object allocated to it. 

Dynamic language is different from dynamic typed language. 

 

No comments:

Post a Comment

Difference between Procedure Oriented Programming System and Object Oriented Programming System (POPS vs OOPS)

POPS vs OOPS   Today we will get to know the difference between Procedure oriented Programming system (POPS) and  Object-Oriented  Programmi...