ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
 Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related       
Suggest New Category 
 


 

View Page with Answers
  Question  Asked @ Answers Views     select
 
What is the importance in context in JDBC connection pools? iFlex  2  140
How many statements can be created with one connection in jdbc? Polaris  2  1468
where do we use init()  2  445
what is difference between excute query ()and execute update ()? Symphony  5  1567
what is prepare statement? what is calabedtarement? Symphony  1  208
what is stringtolennizer with example? Symphony  1  680
how to compile jsp? Logica-CMG  3  1159
how many types of cloning? Mobily  1  1039
what are the new features available in java 1.5 version? Motorola   2  1745
what is webservices? CTS  1  916
what is hashmap& hashtable with example? CTS  1  546
Difference between String and StringBuffer. IBM   3  2025
how to open and edit XML file in Weblogic??? Symphony  0  150
Same common question what is Map,Set,HashMap,List???? Symphony  3  752
how to connect one jsp page to another jsp page???? Symphony   4  3009
E-Mail New Answers        Answer Selected Questions        Post New Core Java Question
 
Prev    1   ... 7   ... 13   ... 19    26   [27]    28  ... 37   ... 43   ... 49   ... 55   ... 61   ... 67   ... 73   ... 79    Next
 
 
 Core Java interview questions   Core Java Interview Questions  Advanced Java interview questions   Advanced Java Interview Questions  Swing interview questions   Swing Interview Questions
 EJB interview questions   EJB Interview Questions  Servlets interview questions   Servlets Interview Questions  Struts interview questions   Struts Interview Questions
 JDBC interview questions   JDBC Interview Questions  JMS interview questions   JMS Interview Questions  SunOne interview questions   SunOne Interview Questions
 J2EE interview questions   J2EE Interview Questions  Weblogic interview questions   Weblogic Interview Questions  Websphere interview questions   Websphere Interview Questions
 Java Networking interview questions   Java Networking Interview Questions  Java J2EE AllOther interview questions   Java J2EE AllOther Interview Questions
 
 
 
Un-Answered Questions
 
 Question Views Asked at   Select
 
Write a program for recursive Traverse? 245  
What are the names of Component subclasses that support painting? 167  
can any one tell me what is advantage of encapsulation 113  
Write the code for Palindrome ? 101 Bally-Technologies
What is files manifesting? 107  
How to solve the problem of generating the unique hash keys with hash function? 63  
how to run ecllipse with jettyserver for windows environment using batch file 96  
Tell me the difference between an applet and a Japplet? 231  
what is servlet enginee? 98 Covansys
3.2 Consider the following class: public class Point { protected int x, y; public Point(int xx, int yy) { x = xx; y = yy; } public Point() { this(0, 0); } public int getx() { return x; } public int gety() { return y; } public String toString() { return "("+x+", "+y+")"; } } Say you wanted to define a rectangle class that stored its top left corner and its height and width as fields. 3.2.1 Why would it be wrong to make Rectangle inherit from Point (where in fact it would inherit the x and y coordinates for its top left corner and you could just add the height and width as additional fields)? (1) 8 Now consider the following skeleton of the Rectangle class: public class Rectangle { private Point topLeft; private int height, width; public Rectangle(Point tl, int h, int w) { topLeft = tl; height = h; width = w; } public Rectangle() { this(new Point(), 0, 0); } // methods come here } 3.2.2 Explain the no-argument constructor of the Rectangle class given above. 3.2.3 Write methods for the Rectangle class to do the following: • a toString() method that returns a string of the format "top left = (x, y); height = h; width = w " where x, y, h and w are the appropriate integer values. • an above() method that tests whether one rectangle is completely above another (i.e. all y values of the one rectangle are greater than all y values of the other). For example, with the following declarations Rectangle r1 = new Rectangle(); Rectangle r2 = new Rectangle(new Point(2,2), 1, 4); the expression r2.above(r1) should give true, and r2.above (r2) should give false. (You can assume that the height of a rectangle is never negative.) (2) (5) 27  
What is Unicast and Multicast object? Where we will use? 171  
Name the components that are termed to be Heavy-weight component but available in Light-weight components? 371  
What is clipping and repainting and what is the relation between them? 430  
Question 5 [15] Consider the following classes, illustrating the Strategy design pattern: import java.awt.*; abstract class Text { protected TextApplet tA; protected Text(TextApplet tApplet) { tA = tApplet; } abstract public void draw(Graphics g); } class PlainText extends Text { protected PlainText(TextApplet tApplet) { super(tApplet); } public void draw(Graphics g) { g.setColor(tA.getColor()); g.setFont(new Font("Sans-serif", Font.PLAIN, 12)); g.drawString(tA.getText(), 20, 20); } } class CodeText extends Text { protected CodeText(TextApplet tApplet) { super(tApplet); } public void draw(Graphics g) { g.setColor(tA.getColor()); g.setFont(new Font("Monospaced", Font.PLAIN, 12)); g.drawString(tA.getText(), 20, 20); } } public class TextApplet extends java.applet.Applet { protected Text text; protected String textVal; protected Color color; public String getText() { return textVal; } public Color getColor() { return color; } public void init() { textVal = getParameter("text"); String textStyle = getParameter("style"); String textColor = getParameter("color"); if (textStyle == "code") text = new CodeText(this); else text = new PlainText(this); if (textColor == "red") color = Color.RED; else if (textColor == "blue") color = Color.BLUE; else color = Color.BLACK; } public void paint(Graphics g) { text.draw(g); 10 } } The Text class is more complicated than it should be (there is too much coupling between the Text and TextApplet classes). By getting rid of the reference to a TextApplet object in the Text class and setting the colour in the paint() method, one could turn the Text class into an interface and simplify the strategy classes considerably. 5.1 Rewrite the Text and PlainText classes to do what is described above. (6) 5.2 Explain the consequent changes that are necessary to the TextApplet class. (4) 5.3 Write an additional strategy class called FancyText (to go with your simplified strategy classes) to allow fancy text to be displayed for the value "fancy" provided for the style parameter. It should use the font Font ("Serif", Font.ITALIC, 12). (3) 5.4 Explain what changes are necessary to the TextApplet class for this. (2) 21  
which pattern is default in scanner package? 56 Satyam
what is collatration? 164  
if u open login & logout ,how can udisplay the timelogin & logout members ? 80 Virtusa
which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com 17 IBM
Question 6 [9] 6.1 In what situations (in general) would you use a TreeMap? (3) 6.2 In what situations (in general) would you use a HashSet to store a collection of values? 22  
Which Component subclass is used for drawing and painting? 129  
E-Mail New Answers        Answer Selected Questions
 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com