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


Please Help Members By Posting Answers For Below Questions

What is the reason behind using constructors and destructors?

553


How to instantiate static nested classes in java?

562


Why are arrays useful in java?

540


Can a class extend more than one class?

607


Can we declare a constructor as final?

674






Can we compare two strings in java?

554


Explain the reason behind ending a program with a system.exit(0)?

594


Explain what do you mean by functional overloading in java?

553


Which variables are stored in heap?

537


Is it possible for a yielded thread to get chance for its execution again?

507


What is meant by interface?

559


What is the difference between scrollbar and scrollpane?

607


What is a parameter in a function?

524


What is lazy initialization in java?

550


How do you read a char in java?

459