Question-27: What is this in java?
Answer:
It is a keyword that that refers to the current object.
Question-28: What is Inheritance?
Answer:
Inheritance is a mechanism in which one object acquires all the properties and behaviour of another object of another class. It represents IS-A relationship. It is used for Code Resusability and Method Overriding.
Question-29: Which class is the superclass for every class.?
Answer:
Object class.
Question-30: Why multiple inheritance is not supported in java?
Answer:
To reduce the complexity and simplify the language, multiple inheritance is not supported in java in case of class.
Quetion-31: What is composition?
Answer:
Holding the reference of the other class within some other class is known as composition.
Question-32: What is difference between aggregation and composition?
Answer:
Aggregation represents weak relationship whereas composition represents strong relationship. For example: bike has an indicator (aggregation) but bike has an engine (compostion).
Question-33: Why Java does not support pointers?
Answer:
Pointer is a variable that refers to the memory address. They are not used in java because they are unsafe (unsecured) and complex to understand.
Question-34: What is super in java?
Answer:
It is a keyword that refers to the immediate parent class object.
Question-35: Can you use this() and super() both in a constructor?
Answer:
No. Because super() or this() must be the first statement.
Question-36: What is object cloning?
Answer:
The object cloning is used to create the exact copy of an object.
Answer:
It is a keyword that that refers to the current object.
Question-28: What is Inheritance?
Answer:
Inheritance is a mechanism in which one object acquires all the properties and behaviour of another object of another class. It represents IS-A relationship. It is used for Code Resusability and Method Overriding.
Question-29: Which class is the superclass for every class.?
Answer:
Object class.
Question-30: Why multiple inheritance is not supported in java?
Answer:
To reduce the complexity and simplify the language, multiple inheritance is not supported in java in case of class.
Quetion-31: What is composition?
Answer:
Holding the reference of the other class within some other class is known as composition.
Question-32: What is difference between aggregation and composition?
Answer:
Aggregation represents weak relationship whereas composition represents strong relationship. For example: bike has an indicator (aggregation) but bike has an engine (compostion).
Question-33: Why Java does not support pointers?
Answer:
Pointer is a variable that refers to the memory address. They are not used in java because they are unsafe (unsecured) and complex to understand.
Question-34: What is super in java?
Answer:
It is a keyword that refers to the immediate parent class object.
Question-35: Can you use this() and super() both in a constructor?
Answer:
No. Because super() or this() must be the first statement.
Question-36: What is object cloning?
Answer:
The object cloning is used to create the exact copy of an object.
Nice site. And the posts are really very good & helpful. for learning much more about java just have a tour at our site
ReplyDelete