0% found this document useful (0 votes)
4 views

java

Uploaded by

tithi.dey0303
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

java

Uploaded by

tithi.dey0303
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

There are four types of oops concept-

Polymorphism

Encapsulation

Abstraction

Inheritance

Polymorphism had been formed using two words- many and forms.

In polymorphism there are two types- function overloading(compile time polymorphism)

Function overwriting(run time polymorphism)

Rules of polymorphism-

Why compile time ?

Inheritance- java ki ek class jb dusre class ki properties ko inherit krti h.

Inheritance incresae the reusability.

It is of four types.

Polymorphism-

Function overloading-there are several rules for function overloading.

Either the parameter or returntype should be different

Which is better runtime polymorphism ya compile type 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 –

1.single level inheritance

2.multilevel

3 hierarchal

4 hybrid

Access modifiers-public, private, protected and default

Main function is always public because when compiler need to execute the main function it should
be accessible

When any access modifier is not mentioned then it is default modifier.

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 .

Abstract class can have abstract and non abstract methods.

It cannot be instantiated.

It can have constructors.

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.

The concept of multiple inheritance can be implemented using interfaces.

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.

You might also like