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");
}
}

Answers were Sorted based on User's Feedback



we know that every java prog must follows OOPS Principles. Anybody can answer, HOW THE FOLLOWING PR..

Answer / srinivas battula

Java is Pure OOPS... Try writing a java program without
Class. i.e. public class Test {}, In this way it satisfies
Oops Concept.
Abstraction: Take any thing like static, system,etc. we
don't know the internal functionalities, but by calling
them we are achieving the task. Here it is hiding the
complexities but representing essential features.
Encapsulation: By writing a program you are grouping all
the methods, variables,etc there by satisfying Encapsulation
Inheritence: When reusability occurs, you satisfy this
concept.
Polymorphism: We achieve it through Overloading and
Overriding in Java in most of the concepts.

Is This Answer Correct ?    4 Yes 1 No

we know that every java prog must follows OOPS Principles. Anybody can answer, HOW THE FOLLOWING PR..

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

we know that every java prog must follows OOPS Principles. Anybody can answer, HOW THE FOLLOWING PR..

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

More Core Java Interview Questions

can we create object for static class in java

14 Answers   IAP Company, IBM, Marlabs, mPortal, TCS,


what is function overloading in java?

0 Answers   Tavant Technologies, TCS, Virtusa,


Accenture NJ mostly ask question on Collection like 1)How to sort Objcts and how treeset sort them 2)Explain mechanism of Hashcode finding in Java 3)Name some of the Sorted collection.

2 Answers   Accenture,


Describe the Big-O Notation.

0 Answers   Global Logic,


Is it possible to write JAVA program without including any of the packages,such as "import java.io.*"; bcoz I instantly wrote a code without "import..." statement and runned the program on command Line & it worked. the code is: class Person { String name; int age; Person(String s,int a) { name = s; age = a; } accept() { System.out.println(name+"Hi!!!!!"); System.out.println(age); } } class Demo { public static void main(Strings args[])throws IOException { String name = args[0]; int age = Integer.parseInt(args[1]); Person p = new Person(name,age); p.accept(); } }

3 Answers  






What is the benefit of inner / nested classes ?

0 Answers  


What class allows you to read objects directly from a stream in java programming?

0 Answers  


What is main string [] args?

0 Answers  


What’s a deadlock?

0 Answers  


Explain the difference between the Boolean & operator and the && operator?

1 Answers  


Write a program to print count of empty strings in java 8?

0 Answers  


What is a variable declaration?

0 Answers  


Categories