What is an object in Java and what are its benefits?
Answers were Sorted based on User's Feedback
Answer / sumit pal singh
An object in java is a runtime entity of a java class. It has two characteristics 1. State (variables) and 2. Behavior (methods). It has below benefits
1. By creating the object of one class into another class we can get the state and behaviour of another class . i.e. Composition is best example for using the object.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / amit
In Java,The object will have its own state and access to all of the behavior defined by the class.
| Is This Answer Correct ? | 1 Yes | 0 No |
Object is an instance of a class. The object will have its own state and access to all of the behavior defined by the class.
| Is This Answer Correct ? | 0 Yes | 0 No |
An object in java is a runtime entity of a java class. It has two characteristics 1. State (variables) and 2. Behavior (methods). It has below benefits
1. Encapsulation (Data hiding): It hides data and internal implementation from other objects.
2. Modularity (task modulation): It contains a set of activities for a specific task of an application.
3. Reusability: It facilitates reusability of functionality through inheritance.
4. Easy maintenance: It enhance the readability and understandability of an application. It also helps the developer to trace bugs in an application.
5. Pluggable/Unpluggable: An erroneous/unwanted object can be removed and a new object can be added in an application.
| Is This Answer Correct ? | 1 Yes | 2 No |
What is flag in python?
How do you trim a space in java?
What is the difference between preemptive scheduling and time slicing?
How to implement Singleton
In real time project which driver did u use? What is the main functionality of the Prepared Statement?
What is a method declaration?
interface X{ void m1(); void m2(); } class Child2 extends Object implements X { public void m1(){ System.out.println("Child2 M1"); } public void m2(){ System.out.println("Child2 M2"); } } public class ParentChildInfterfaceDemo { public static void main(String[] args){ X x = new Child2(); X x1 = new Child2(); x.m1(); x.m2(); x.equals(x1); } } Will the above code work? If yes? Can you please explain why the code x.equals(x1) will work as the equals method is called on interface reference vaiable?
What is the purpose of extern variable?
Explain the concept of proper inheritance?
0 Answers Thomson Reuters, Virtusa,
Why are variables important in research?
What is Hash Code in Java?
How long will it take to learn java?