HeadStrong Java Placement Paper For Freshers Part-1
A class is a blueprint, or prototype, that defines the variables and the methods common to all objects of a certain kind.
2. What is a object?
An object is a software bundle of variables and related methods.An instance of a class depicting the state and behavior at that particular time in real world.
3. What is a method?
Encapsulation of a functionality which can be called to perform specific tasks.
4. What is encapsulation? Explain with an example.
Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessible via the interface of the object
5. What is inheritance?
Explain with an example. Inheritance in object oriented programming means that a class of objects can inherit properties and methods from another class of objects.
6. What is polymorphism?
Explain with an example. In object-oriented programming, polymorphism refers to a programming language’s ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results. Polymorphism is considered to be a requirement of any true object-oriented programming language
7. Is multiple inheritance allowed in Java?No, multiple inheritance is not allowed in Java.
8. What is interpreter and compiler?
Java interpreter converts the high level language code into a intermediate form in Java called as bytecode, and then executes it, where as a compiler converts the high level language code to machine language making it very hardware specific
9. What is JVM?
The Java interpreter along with the runtime environment required to run the Java application in called as Java virtual machine(JVM)
10. What are the different types of modifiers?
There are access modifiers and there are other identifiers. Access modifiers are public, protected and private. Other are final and static.