Do you like to switch your career? Here's our recommendation on the important things to need to prepare for the job interview to achieve your career goals in an easy way. Java Programming is based on OOPS (Object Oriented Programming). It allows users create the objects that they want and then create methods to handle those objects. Manipulating these objects to get results is the goal of Object Oriented Programming. Core concepts are Object, Inheritance, Polymorphism, Abstraction, Encapsulation, Association, Aggregation. One can check the availability of the job across cities including Mumbai, Delhi, Bangalore, Pune and Hyderabad. Follow Wisdomjobs page for Java Programming with OOPS concept job interview questions and answers page to get through your job interview successfully in first attempt.
Question 1. What Is An Abstract Class?
Answer :
Abstract class is a class that has no instances. An abstract class is written with the expectation that its concrete subclasses will add to its structure and behavior, typically by implementing its abstract operations.
Question 2. What Is A Destructor?
Answer :
Destructor is an operation that frees the state of an object and/or destroys the object itself. In Java, there is no concept of destructors. It’s taken care by the JVM.
Question 3. What Is A Subclass?
Answer :
Subclass is a class that inherits from one or more classes.
Question 4. What Is A Superclass?
Answer :
Superclass is a class from which another class inherits.
Question 5. What Is An Object?
Answer :
Object is an instance of a class. It has state, behaviour and identity. It is also called as an instance of a class.
Question 6. What Is Collaboration?
Answer :
Collaboration is a process whereby several objects cooperate to provide some higher level behavior.
Question 7. What Is Meant By Binding?
Answer :
Binding denotes association of a name with a class
Question 8. What Is Meant By Dynamic Binding?
Answer :
Dynamic binding is a binding in which the class association is not made until the object is created at execution time. It is also called as late binding.
Question 9. What Is Meant By Encapsulation?
Answer :
Encapsulation is the process of compartmentalizing the elements of an abstraction that defines the structure and behavior. Encapsulation helps to separate the contractual interface of an abstraction and implementation.
Question 10. What Is Meant By Inheritance?
Answer :
Inheritance is a relationship among classes, wherein one class shares the structure or behavior defined in another class. This is called Single Inheritance. If a class shares the structure or behavior from multiple classes, then it is called Multiple Inheritance. Inheritance defines “is-a” hierarchy among classes in which one subclass inherits from one or more generalized superclasses.
Question 11. What Is Meant By Object Oriented Programming?
Answer :
OOP is a method of programming in which programs are organized as cooperative collections of objects. Each object is an instance of a class and each class belong to a hierarchy.
Question 12. What Is Meant By Persistence?
Answer :
Persistence is the property of an object by which its existence transcends space and time.
Question 13. What Is Meant By Polymorphism?
Answer :
Polymorphism literally means taking more than one form. Polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class.
Question 14. What Is Meant By Abstraction?
Answer :
Abstraction defines the essential characteristics of an object that distinguish it from all other kinds of objects. Abstraction provides crisply-defined conceptual boundaries relative to the perspective of the viewer. It’s the process of focusing on the essential characteristics of an object. Abstraction is one of the fundamental elements of the object model.
Question 15. What Is Meant By Static Binding?
Answer :
Static binding is a binding in which the class association is made during compile time. This is also called as early binding.
Question 16. What Is Multiple Inheritance And Does Java Support?
Answer :
If a child class inherits the property from multiple classes is known as multiple inheritance. Java does not allow to extend multiple classes. The problem with with multiple inheritance is that if multiple parent classes has a same method name, the at runtime it becomes diffcult for compiler to decide which method to execute from the child class. To overcome this problem it allows to implement multiple Interfaces.
Question 17. What Is Association?
Answer :
Association is a relationship where all object have their own lifecycle and there is no owner. Let's take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently.
Question 18. What Is Aggregation?
Answer :
Aggregation is a specialize form of Association where all object have their own lifecycle but there is ownership and child object can not belongs to another parent object. Let's take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about "has-a" relationship.
Question 19. What Is Composition?
Answer :
Composition is again specialize form of Aggregation and we can call this as a "death" relationship. It is a strong type of Aggregation. Child object dose not have their lifecycle and if parent object deletes all child object will also be deleted. Let's take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete.
Question 20. What Is Difference Between Polymorphism And Inheritance?
Answer :
Question 21. When Super Keyword Is Used?
Answer :
If the method overrides one of its superclass's methods, overridden method can be invoked through the use of the keyword super. It can be also used to refer to a hidden field.
Question 22. Does Java Support Multiple Inheritance?
Answer :
No, Java does not support multiple inheritance. Each class is able to extend only on one class, but is able to implement more than one interfaces.
Question 23. What Is The Differences Between Abstraction And Encapsulation?
Answer :
Abstraction and encapsulation are complementary concepts. On the one hand, abstraction focuses on the behavior of an object. On the other hand, encapsulation focuses on the implementation of an object’s behavior. Encapsulation is usually achieved by hiding information about the internal state of an object and thus, can be seen as a strategy used in order to provide abstraction.
Question 24. Whatt Is Function Overriding And Overloading In Java ?
Answer :
Method overloading in Java occurs when two or more methods in the same class have the exact same name, but different parameters. On the other hand, method overriding is defined as the case when a child class redefines the same method as a parent class. Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides.
Question 25. What Is A Constructor, Constructor Overloading In Java And Copy-constructor?
Answer :
A constructor gets invoked when a new object is created. Every class has a constructor. In case the programmer does not provide a constructor for a class, the Java compiler (Javac) creates a default constructor for that class. The constructor overloading is similar to method overloading in Java. Different constructors can be created for a single class. Each constructor must have its own unique parameter list. Finally, Java does support copy constructors like C++, but the difference lies in the fact that Java doesn’t create a default copy constructor if you don’t write your own.
Question 26. What Is The Difference Between An Interface And An Abstract Class?
Answer :
Java provides and supports the creation both of abstract classes and interfaces. Both implementations share some common characteristics, but they differ in the following features:
Question 27. What Are Pass By Reference And Pass By Value?
Answer :
When an object is passed by value, this means that a copy of the object is passed. Thus, even if changes are made to that object, it doesn’t affect the original value. When an object is passed by reference, this means that the actual object is not passed, rather a reference of the object is passed. Thus, any changes made by the external method, are also reflected in all places.
Answer :
The static keyword denotes that a member variable or method can be accessed, without requiring an instantiation of the class to which it belongs. A user cannot override static methods in Java, because method overriding is based upon dynamic binding at runtime and static methods are statically binded at compile time. A static method is not associated with any instance of a class so the concept is not applicable.
Question 29. Can You Access Non Static Variable In Static Context?
Answer :
A static variable in Java belongs to its class and its value remains the same for all its instances. A static variable is initialized when the class is loaded by the JVM. If your code tries to access a non-static variable, without any instance, the compiler will complain, because those variables are not created yet and they are not associated with any instance.
Question 30. What Is Runtime Polymorphism?
Answer :
Question 31. What Is The Difference Between Static Binding And Dynamic Binding?
Answer :
In case of static binding type of object is determined at compile time whereas in dynamic binding type of object is determined at runtime.
Answer :
Object based programming languages follow all the features of OOPs except Inheritance. Examples of object based programming languages are JavaScript, VBScript etc.
Answer :
The object references are all initialized to null in Java.
Question 34. Can We Override Static Method?
Answer :
No, you can't override the static method because they are the part of class not object.
Question 35. Why We Cannot Override Static Method?
Answer :
It is because the static method is the part of class and it is bound with class whereas instance method is bound with object and static gets memory in class area and instance gets memory in heap.
Question 36. Difference Between Method Overloading And Overriding.
Answer :
Method Overloading :
Method Overriding :
Question 37. Can You Use Abstract And Final Both With A Method?
Answer :
No, because abstract method needs to be overridden whereas you can't override final method.
Question 38. What Is Blank Or Uninitialized Final Variable?
Answer :
A final variable that is not initialized at the time of declaration is known as blank final variable.
If you want to create a variable that is initialized at the time of creating object and once initialized may not be changed, it is useful. For example PAN CARD number of an employee. It can be initialized only in constructor.
Question 39. What Is Covariant Return Type?
Answer :
The covariant return type specifies that the return type may vary in the same direction as the subclass.
Before Java5, it was not possible to override any method by changing the return type. But now, since Java5, it is possible to override method by changing the return type if subclass overrides any method whose return type is Non-Primitive but it changes its return type to subclass type.
Question 40. Can There Be Any Abstract Method Without Abstract Class?
Answer :
No, if there is any abstract method in a class, that class must be abstract.
Java programming with oops concepts Related Tutorials |
|
---|---|
J2EE Tutorial | Core Java Tutorial |
C Tutorial | AJAX Tutorial |
JSP Tutorial | Java Servlets Tutorial |
Hibernate Tutorial | Java Tutorial |
NHibernate Tutorial | Apache Struts 2 Tutorial |
Java programming with oops concepts Related Practice Tests |
|
---|---|
J2EE Practice Tests | Core Java Practice Tests |
C Practice Tests | AJAX Practice Tests |
JSP Practice Tests | Java Struts Practice Tests |
Java Servlets Practice Tests | Hibernate Practice Tests |
JSTL(JSP Standard Tag Library) Practice Tests |
Java Programming With Oops Concepts Practice Test
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.