When you clone an object that is from a class that uses the

When you clone an object that is from a class that uses the clone() method of the Object class (meaning it doesn\'t create its own clone() method), and there are fields that are not primitives in that class, then what type of copy of that object is the result:

A) shallow copy

B) deep copy

C) complete copy

D) abstract copy

Which of the following JavaFX sources can generate a KeyEvent?

A) Button

B) CheckBox

C) Scene

D) ComboBox

Solution

Answer:

C) complete copy

protected Object clone() throws CloneNotSupportedException - this method is used to create a copy of an object of a class which implements Cloneable interface. By default it does field-by-field copy as the Object class doesn\'t have any idea in advance about the members of the particular class whose objects call this method. So, if the class has only primitive data type members then a completely new copy of the object will be created and the reference to the new object copy will be returned. But, if the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.

Answer:

A) Button

Key events indicate when the user is typing at the keyboard. Specifically, key events are fired by the component with the keyboard focus when the user presses or releases keyboard keys.

When you clone an object that is from a class that uses the clone() method of the Object class (meaning it doesn\'t create its own clone() method), and there ar

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site