4.1 Supply contracts (in the form of comments specifying
pre- and post conditions)
for the enqueue() method of the LinkedQueue class given in
the Appendix.
(2)
4.2 Let Thing be a class which is capable of cloning
objects, and consider the code
fragment:
Thing thing1 = new Thing(); //(1)
Thing thing2 = thing1; //(2)
Thing thing3 = (Thing) thing1.clone(); //(3)
Explain how the objects thing2 and thing3 differ from each
other after
execution of the statements.
(
No Answer is Posted For this Question
Be the First to Post Answer
Given: 10. interface A { void x(); } 11. class B implements A { public void x() { } public voidy() { } } 12. class C extends B { public void x() {} } And: 20. java.util.List list = new java.util.ArrayList(); 21. list.add(new B()); 22. list.add(new C()); 23. for (A a:list) { 24. a.x(); 25. a.y();; 26. } What is the result? 1 Compilation fails because of an error in line 25. 2 The code runs with no output. 3 An exception is thrown at runtime. 4 Compilation fails because of an error in line 20.
Explain what are final variable in java?
What does n mean?
What is the use of set in java?
What is the middleware?
What is the purpose of sizeof operator?
What happens if an exception is not handled in a program?
Can we instantiate Interfaces?
What is java virtual machine? Explain
How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car object. On what basis it will sort?
What restrictions are placed on method overloading in java programming?
If circular link of two objects, then will it be garbage collected ?