How OOPS concept is achieved in Java?
Answers were Sorted based on User's Feedback
Answer / kk
Encapsulation,Inheritance,Polymorphism are OOPS principles.
In Java, these OOPS principles are achieved as follows:
Encapsulation & data hiding is achieved thru access modifiers
Inheritance is achieved thru Interfaces
Polymorphism is achieved thru overloading of methods
|Is This Answer Correct ?||43 Yes||11 No|
Answer / james
1) Encapsulation:- is achieved through
classes.(Binding/Storing data and methods as a single unit )
2) Abstraction:-it is achieved through private, protected,
public, default keywords.
3)Inheritance through interfaces.
4)polymorphism is achieved through method overloading and
5)Message Passing -through objects calling
|Is This Answer Correct ?||30 Yes||6 No|
Answer / ranjan
Encapsulation which is achieved by making classes.
Inheritance which is achieved by extending class and implementing interfaces.
polymorphism is achieved by function overriding and function overloading. Operator overloading is not allowed in java although implicitly string class uses + operator..
note : Abstraction is nothing its just showing functionality and hiding complexity
|Is This Answer Correct ?||7 Yes||2 No|
Answer / rahul
Thru java encapsulation, inheritence, polymorphism.
|Is This Answer Correct ?||1 Yes||5 No|
Answer / abhiram patil
1)using Classes & Interfaces
|Is This Answer Correct ?||5 Yes||17 No|
Is null a string?
Say you want to store the information about a number of pets in an array. Typical information that you could store for each pet (where relevant) would be • Breed of animal • Animal's name • Its birth date • Its sex • Whether it has been sterilised or not • When it is due for its next inoculation • When it last had its wings clipped For each type of pet (eg. dog, cat or bird) you would typically define a class to hold the relevant data. Note: You do not need to implement these classes. Just answer the following questions. 3.1.1 What would be the advantage of creating a superclass (eg. Pet) and declaring an array of Pet objects over simply using an array of Objects, storing each of the instances of the different pet classes (eg. Dog, Cat or Bird) in it? 3.1.2 Would you define Pet as a class or as an interface? Why? (2) (2)
what is optional in java 8?
Can you extend more than one interface?
What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?
What is deserialization and how do we do deserialization?
Why is serialization required?
Differece between class and generic class?
What is the file extension for java?
Explain the difference between protected and default access.
In treeset we add same object ...what will be the out put
Is namespace same as package in java?