Polymorphism In Java Programming Language

1618 Words7 Pages

Java programming language is a computer programming language that allows a programmer to write computer instructions using an English-based command instead of using numeric codes. Java was created by James Gosling from Sun Microsystems in 1991, whose first publicly available version was released in 1995. The target of java is to write a program once and be able to run it on multiple operating systems.
Java has its own structure, syntax rules and programming paradigm based on the concept of object-oriented programming. The java language is a C-language derivative (evolved), hence its syntax rules are more like C’s. Java language starts with packages, these are the namespace mechanism and within packages are classes, within classes are methods, …show more content…

Polymorphism allows ne interface to be used for a general class of actions and the behavior depends on the types of data used in the operation. It plays a vital role in allowing objects that have different internal structures that share the similar external interface. Polymorphism is extensively used in implementing inheritance.
There are two forms of polymorphism;
Method overloading – method overloading is when different meanings are implied by the code itself, compile time polymorphism
Method overriding – method overriding is when the different meanings are implied by the values of the variables, runtime polymorphism Java access modifiers:
Java access modifiers help in structuring a program in having proper scoping, there are three different keywords; private, protected and public.
Private: it helps in encapsulating methods and variables most effectively, they are meant to be directly accessed by the java class that owns them. The only way to access a private method is within the class that defined them in the first …show more content…

There is no need to remove unreferenced objects because there is automatic garbage collection in java programming.
Secure:
Java is secure as there are no pointers and one cannot access out of bound arrays, which is why it is impossible to exploit in java as there are no security flaws like buffer overflow or stack corruption. Java programs run inside virtual machine sandbox, and also has a class loader adding it security by separating the package for the classes of the local file system from the imported from network sources. Java is secure because it has a Bytecode Verifier that checks the code fragments for illegal code that can violate access right to objects.
Robust

More about Polymorphism In Java Programming Language

Open Document