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 / sree
Inheritance: Every class is extended of Object class, so in
here a extends Object. this is Inheritance.
Polymorphism: means single entity multiple views.
here only one method is there. if here multiple views, then
only it would become like Polymorphism concept.
Encapsulation: Wrapping up of data and code means methods,
variables, code, and all. every java program is based on
Encapsulation concept.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the reason behind using constructors and destructors?
How to instantiate static nested classes in java?
Why are arrays useful in java?
Can a class extend more than one class?
Can we declare a constructor as final?
Can we compare two strings in java?
Explain the reason behind ending a program with a system.exit(0)?
Explain what do you mean by functional overloading in java?
Which variables are stored in heap?
Is it possible for a yielded thread to get chance for its execution again?
What is meant by interface?
What is the difference between scrollbar and scrollpane?
What is a parameter in a function?
What is lazy initialization in java?
How do you read a char in java?