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
What does compareto () do in java?
Explain the selection sort algorithm?
What does method mean?
What is difference between wait and notify in java?
What is a dynamic array in java?
What is the importance of static variable?
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
What is an immutable object?
Why is String immutable?
What are the 3 types of loops in java?
How to compare two strings in java program?
What is a flag variable?
What is the difference between serial and throughput garbage collector?
how to handle exceptions in ejb?
How many types of constructors are used in java?