Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...




Java J2EE Interview Questions
Questions Answers Views Company eMail

What are interfaces?

3 5141

What are invisible components?.

2141

Difference between a Scrollbar and a ScrollPane?

1 7260

What is the difference between a Window and a Frame?

Infosys, ProKarma,

6 24800

Explain break statement and continue statement?

3 13383

What are field variable and local variable?

3 15356

What is the difference between a public and a non-public class?

2 7904

Explain the difference between scrollbar and scrollpane?

1 12478

What is static and a non-static inner class?

3 7782

What is the difference between abstract class and interface?

Aspire,

3 6643

Tell me the difference between an applet and a Japplet?

1 3881

What is an array and a vector? How they different from each other?

4 8157

What is exception and error? and what is the difference between them?

2 6536

Explain difference between final, finally and finalize?

Cognizant,

3 29457

Explain the difference between getAppletInfo and getParameterInfo?

1 6790


Un-Answered Questions { Java J2EE }

Describe the two types of formbeans.

998


How to change from default jvm to others?

935


What is java swing components?

1096


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)

2275


Why are getters and setters used?

1058


What is chat area? Explain.

1018


List implementations of list interface?

1032


What is delegatingvariableresolver?

395


Are the struts tags xhtml compliant ?

939


What is spring jdbc template?

519


What is data type modifier?

937


Is swing an adjective?

999


What is the usage of Hibernate QBC API?

489


What is a databasemetadata?

948


What do you mean by a JVM?

1244