we know that every java prog must follows OOPS Principles.
Anybody can answer, HOW THE FOLLOWING PROGRAM FOLLOWS OOPS
CONCEPTS i.e, Inheritance,Polymarphism,Encapsulation?
class a{
public static void main(String args[]){
System.out.println("Hello World");
}
}
Answer Posted / srinivas battula
Java is Pure OOPS... Try writing a java program without
Class. i.e. public class Test {}, In this way it satisfies
Oops Concept.
Abstraction: Take any thing like static, system,etc. we
don't know the internal functionalities, but by calling
them we are achieving the task. Here it is hiding the
complexities but representing essential features.
Encapsulation: By writing a program you are grouping all
the methods, variables,etc there by satisfying Encapsulation
Inheritence: When reusability occurs, you satisfy this
concept.
Polymorphism: We achieve it through Overloading and
Overriding in Java in most of the concepts.
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Does variable declaration allocate memory?
What is the difference between heap and stack memory?
How do you sort a set in java?
Which is better singleton or static class?
What are the 8 data types in java?
Are arrays immutable in java?
What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?
Explain differences between checked and unchecked exceptions in java?
How do you read and print a string in java?
Can you make a constructor final in Java?
What are the 4 versions of java?
What are the restrictions imposed by a Security Manager on Applets?.
Why do we need singleton?
what is the use of bean managed and container managed with example?
Is string a data type in java?