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
Is 0 true or false?
Does string is thread-safe in java?
What are the types of collections in java?
What is variable and constant explain with example?
Explain the difference between collection api and stream api in java8?
Is java hard to learn?
What are the different tags provided in jstl?
How to sort numbers in java without array?
What is tree in java?
What is the use of runnable interface?
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
What is the maximum size of hashmap in java?
What does mean in regex?
Can singleton class be serialized?
what is singleton in java?