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
How does list work in java?
How we create object in copy constructor?
Why do we create threads in java?
Enlist diffrent types of inheritance supported by java?
What java is used for?
what are the methods in object?
What is the use of using enum to declare a constant?
Can we execute a program without main() method?
Can Exception handling we can handle multiple catch blocks?
what is predefined function in java?
What do you understand by access specifiers in Java?
Can a final variable be manipulated in java?
What does microservices mean?
Why does java not allow multiple public classes in a java file ?
What language is an assembler written in?