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.
(



4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueu..

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

Post New Answer

More Core Java Interview Questions

What is the main purpose of serialization in java?

1 Answers  


What is unicode in java?

1 Answers  


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?

4 Answers   Satyam,


What is join () in java?

1 Answers  


What is the flag in java?

1 Answers  


how jvm allocates memory for stack?

1 Answers   HP, Ramco,


what is meant by abstract class?

1 Answers   Aspire,


Why arraylist is not synchronized in java example?

1 Answers  


What is the use of arraylist in java?

1 Answers  


What is keyword auto for?

1 Answers  


Why do we need array in java?

1 Answers  


what is abstract class in Java?

1 Answers   Hexaware, Syntel,


Categories