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  >>  Java J2EE  >>  Java Related       
 
  Core Java (1201)   Advanced Java (263)   Swing (41)   EJB (124)   Servlets (203)
  Struts (134)   JDBC (159)   JMS (4)   SunOne (3)   J2EE (27)
  Weblogic (34)   Websphere (3)   Java Networking (17)   Java J2EE AllOther (58)
 
Suggest New Category 
 


 

View Page with Answers
  Question  Asked @ Answers Views     select
 
Explain the difference between GET and POST methods?  3  2680
What is the difference between ExecuteUpdate and ExecuteQuery?  4  2466
what is the advantage of using Servlets over CGI programming?  2  1645
What is the default HttpRequest method?  1  1336
What is the capacity that doGet method can send to the server?  3  1299
What is the advantage of Servlets when compared with other server side technologies?  0  226
What is the ServletConfig() and what is its use? Google  3  1946
how a user session can be tracked in servlets?  1  1063
What is servlet tunnelling?  1  1665
What is servlet exception? EDS   4  1853
What is ServletContext() and what is its use? Prime-Technology  4  11244
What are the parameters of the service method ?  2  1507
What is context switching?  3  1478
What is Client-Server Computing?  0  213
What is a Proxy Server?  1  702
E-Mail New Answers        Answer Selected Questions       
 
Prev    1   ... 12   ... 23   ... 34   ... 45   ... 56   ... 67   ... 78   ... 89    100   [101]    102  ... 122   ... 133   ... 144    Next
 
 
 Java J2EE interview questions   Java J2EE Interview Questions  J2ME interview questions   J2ME Interview Questions  Java Related AllOther interview questions   Java Related AllOther Interview Questions
 
 
 
Un-Answered Questions
 
 Question Views Asked at   Select
 
What is JDBC Driver interface?How can you retrieve data from the ResultSet 90 CTS
how the action can be map from jsp page to bean class in mvc1 86 Photon
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  
Howto get an object that will perform date & time calculations then format it for output in some different locales with different date style.can ne1 tel me the answer of this question.pls 47  
how to deploy apache tomcat server to weblogic server in java 148 IBM
Java run-time system generates What class of exceptions? 131 TCS
can any one tell me what is advantage of encapsulation 113  
What happens to the Exception object after handling an exception? 120  
how i secure my site with the https protocol.what are the steps? 96  
The new features of the JDBC 2.0 API, will be supported for JDBC-ODBC Bridge? 235  
To identify IDL language what mapping mechanism is used? 237  
What are the differences between Java 1.0 and Java 2.0? 127  
What are the steps involved in developing an RMI object? 167  
How a component can be placed on Windows? 219 Wipro
what is an isolation level? 121  
What is the difference between JDBC 1.0 and JDBC 2.0? 75 Corent-Technology
The following program reads data (details of students) from a file named students.txt and converts it into e-mail addresses. The results are written to a file named studentemail.txt. students.txt consists of a number of lines, each containing the data of a student in colon delimited format: Last Name:First Name:Student Number Each input record is converted to an e-mail address and written to studentemail.txt in the following format: the first character of the last name + the first character of the first name + the last four digits of the student number + “@myunisa.ac.za” import java.io.*; public class EmailConverter { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new FileReader ("students.txt")); PrintWriter output = new PrintWriter(new FileWriter ("studentemail.txt")); String line = input.readLine(); while (line != null) { // Extract the information for each student String[] items = line.split(":"); // Generate the email address String email = "" + items[0].charAt(0) + items[1].charAt(0) + items[2].substring(4,8) + "@myunisa.ac.za"; email = email.toLowerCase(); // Output output.println(email); line = input.readLine(); } input.close(); output.close(); } } Rewrite the class so that it handles possible errors that may occur. In particular, it should do the following: • It should catch at least three appropriate exceptions that might occur, and display suitable messages. • At this stage, the program will not run correctly if there is an empty line in the input file. Change the program so that if an empty line is encountered, an exception is thrown and the empty line is ignored. This exception should be handled with the display of a suitable error message. • Before the e-mail address is added to the output file, check if the student number has 8 digits. If not, throw an InvalidFormatException (which the program should not handle itself) 21  
how can u integrate ejb and hibernate? How can u call hibernateDAO methods in session bean? 148 Infosys
what is meant by multicast? 145  
what is the J2EE BluPrints? 128  
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