Number of View: 17
To format a currency value we use NumberFormat.getCurrencyInstance().
To get default Locale’s currency call NumberFormat.getCurrencyInstance() method.
In getCurrencyInstance() method we can give local to get the currency of the particular locale. Continue reading
Number of View: 50
Servlets follow three phase life cycle initialization,service and destruction.
1) init() method :
1) init() method : init method is called when the servlet is first created.
2) init() method is called exactly once after the instantiating Servlet.
3) init() method is used to write initialization code such as loading database drivers and initialization values so on.
4) When invoking this method servlet container passes a Servlet-Config.
5) One of the most important and common task that init() method performs is reading server specific initialization parameters.
6) The init method is important because the servlet container passes a ServletConfig object, which contains the configuration values given in the web.xml file.
Signature : public void init(ServletConfig servletConfig) throws ServletException
init() method can throw servlet exception.When init() method throws Servlet exception servlet container does not executes service() method.
servletException is also thrown when the method does not return with in the time period.
Number of View: 44
Explain Servlet api and its methods ?
1) All Servlets must implement javax.servlet.Servlet interface either directly or indirectly.
2) Servlet container will create an instance of Servlet class and uses it to handle incoming requests.
3) Servlet interface defines methods that all servlets must implement.
4) Servlet class defines a contract between Servlet and Servlet container.
Number of View: 53
What are Servlets ?
1) Java Servlets are efficient and powerful solution given by sun for creating dynamic content for the web.
2) Servlets are the main and central processing unit for web application.
3) Java Servlets are designed to respond with dynamic content to client requests. Continue reading
Number of View: 139
In java when a field is declared and not initialized,java compiler will be set the default value to the field value based on datatype of the field.Here are the list of datatypes and default values. Continue reading
Number of View: 154
Sometimes in real world a situation may arise where we can supply inputs to the application at the time of program execution.This can be done with help of command line arguments in java.
commandline arguments are the parameters that are supplied to the program at the time of execution. Continue reading
Number of View: 110
Here are some of the important features in java which are removed from c/c++ :
1) Pointers :
C++ supports pointer but java does not supports pointers.
2) Templates :
c++ supports templates but java does not supports templates. Continue reading
Number of View: 123
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space :
Problem : Whenver i run the application with tomcat server iam gettting the following exception. Continue reading
Number of View: 112
org.hibernate.MappingException: Repeated column in mapping for entity:
Number of View: 206
Explain final class variables with example in java?
1) We can declare class variable with final keyword.
2) Final class variables can be initialized in two ways:
1) At the time of declaration
2) Static Initializers Continue reading