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 Related Interview Questions
Questions Answers Views Company eMail

where is .equals() method and how is it different from == operation Is hashing related to these?

iFlex,

4 7990

explain System.out.println()

CTS,

12 20029

Setting Up WebLogic Server for HTTP Tunneling

1 33953

Which parser is used in Struts to parse the Structconfig.xml file.

iFlex,

21 33544

what is wrapper class and its uses?

2 7015

what is bytecode? watz the difference between machine code and bytecode?

Oracle,

9 30559

watz the difference between abstract class and interface? Which one u ill choose as a designer?

Sonata,

1 5378

can we create instance for interface in java?

4 20925

What is Session reduplication and how its done?

2037

Which all r Final classes in java except string?

HCL,

5 34539

what is bytecode ?explain in detail and watz the difference between bytecode and machine code?

Lucent,

6 19437

What is the difference between Get and Post Method?

T3 Softwares,

12 21373

What is the difference between java and .Net?

Bosch,

39 109566

What is the difference between jsp and servlet?

Symphony,

6 13148

Diff between C++ and java?

TCS,

9 12096


Un-Answered Questions { Java Related }

What is actionservlet?

1009


Explain the features of java?

1012


What are basic data types?

1095


What is the use of 'super' keyword inside a constructor?

972


What are the classes and methods used for sending sql statements to database?

1081


how many types of clients in mq?

956


Difference between load and get?

371


What's the base class of all exception classes?

1061


What is difference between stringbuffer and string?

960


How can you run a servlet program?

1085


How do I do http tunneling? : BEA Weblogic

1011


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)

2280


Is minecraft 1.15 out?

977


What are the advantages of collection pools?

1055


Describe, in general, how java's garbage collector works?

1039