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 / dhawal

1]here we use static main method means single copy of that
method is created in memory for that particular class means
we can not accept main method out side the class we can call
this method by using class name,ie javac a.java means this is
ENCAPSULATION
2]here println is a method, its defination writen in out
that is output straem means we obtain
INHERITANCE
3]polymorphisum means one name many form basically base
class pointer in our example when u pass String args[] to
main but can manipulate all type of data inside main this is
POLYMORPHISUM

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does list work in java?

514


How we create object in copy constructor?

654


Why do we create threads in java?

592


Enlist diffrent types of inheritance supported by java?

491


What java is used for?

669






what are the methods in object?

643


What is the use of using enum to declare a constant?

566


Can we execute a program without main() method?

539


Can Exception handling we can handle multiple catch blocks?

650


what is predefined function in java?

550


What do you understand by access specifiers in Java?

597


Can a final variable be manipulated in java?

542


What does microservices mean?

544


Why does java not allow multiple public classes in a java file ?

3459


What language is an assembler written in?

563