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.
(
Answer / Jayanti Chouhan
```javan// Text interfacenpublic interface Text {n void draw(Graphics g);n}nn// PlainText classnpublic class PlainText implements Text {n private Font font;n private Color color;n private String text;n public PlainText(Font f, Color c, String t) {n font = f;n color = c;n text = t;n }n public void draw(Graphics g) {n g.setColor(color);n g.setFont(font);n g.drawString(text, 20, 20);n }n}n```java
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the main purpose of serialization in java?
What is unicode in java?
Can you explain the difference b/n abtract and interface with a good example,?In what cases we have use abtract and what case interface?
What is join () in java?
What is the flag in java?
how jvm allocates memory for stack?
what is meant by abstract class?
Why arraylist is not synchronized in java example?
What is the use of arraylist in java?
What is keyword auto for?
Why do we need array in java?
what is abstract class in Java?