java
java
Polymorphism
Encapsulation
Abstraction
Inheritance
Polymorphism had been formed using two words- many and forms.
Rules of polymorphism-
It is of four types.
Polymorphism-
Compile time polymorphism is better since the error will be detected at the compilation time does it
could be corrected.
Inheritance-
Using the properties of one class into another class.fpou type of inheritance are there –
2.multilevel
3 hierarchal
4 hybrid
Main function is always public because when compiler need to execute the main function it should
be accessible
Protected can be used within same package and other package subclasses.
Private can be used within sAme class. To access the private classes we use getters and setters.
Getters are used to get the info and setters are used to set any value in private class.
Data hiding can be implemented using access modifiers.
Abstract class is used when there are certain features that are needed but that should not be visible
to the user. They exist in imagination or abstractions .
It cannot be instantiated.
There are two methods for abstraction in java , by using abstract keyword and by using the concept
of interfaces. (Interface is pure abstraction) in interfaces there cannot be any non abstract functions
and constructors. For interface if we use implement not extend. all fields in interfaces are public,
static and final by default. All methods are public and abstract by default.
Static variable are used when any value will remain unchanged throughout. Thus static variables are
used and also in an application when there is some common information then we know memory is
allocated only once for static memory so to save memory consumption we will use static variable.