How To Convert Char Array To String In Java?

java-thumbnail

This tutorial is simple example for converting a character array into a simple string object. In general, there are two ways to convert the character array to string object, First approach is to pass the array into the string constructor and second approach is to using the String.valueOf(). Lets look at the example. Output…

StringTokenizer Example

java-thumbnail

StringTokenizer in java.util package is very useful for spliting the length string into the pieces. You can pass a delimeter to the StringTokenizer constructor to split the string where ever that delimeter appeared in the string. If you have not passed any delimeter, by default it splits the string using the empty space in the […]

Compressing and Uncompressing File Example in Java

java-thumbnail

Compressing and Uncompressing of the files is one of the common utility we use in our daily life. If you are using windows, using WinZip is very common to compress the files and sent to others. The advantage of compressing the files is to save the memory occupied for the file in the disk. It […]

Auto Refresh a Web Page In JSP

java-ee-thumbnail

Java EE Tutorials JSP Tutorials Recommended Books for Java Server Pages (JSP) Instead of refreshing the web page all the time, JSP includes such a code in which refreshing is done automatically in the web page. setIntHeader method of response object (HttpServletResponse) can be used for refreshing the page. Signature of this method setIntHeader is […]

Apache Tomcat 8 Features

tomcat-thumbnail

If you are a Java web developer, it is most likely that you are aware of the popularity of Tomcat web server. Tomcat is the Reference Implementation (RI) for the JSP and Servlets specification from the beginning. Not only that, many of the application servers internally using the Tomcat as their web server since it […]

OCPJP 6 Mock Exam -16

ocpjp-6-thumbnail

1 . What will be the output? Choose the one below: Compile time error at line 10 Compilation and output of 123 Compilation and output of the digits “1”, “2” and “3”, but the order can’t be determined Compilation and output of onetwothree Compilation but runtime error at line 10 2 . The following is […]

How To Use JavaBeans in JSP?

java-ee-thumbnail

Java EE Tutorials JSP Tutorials Recommended Books for Java Server Pages (JSP) JavaBeans are simple classes that are used to develop dynamic WebPages. JavaBeans are required to create dynamic web pages by using separate java classes instead of using java code in a JSP page.┬áIt provides getter and setter methods to get and set values […]

Session Tracking in JSP

java-ee-thumbnail

Java EE Tutorials JSP Tutorials Recommended Books for Java Server Pages (JSP) Sessions are mechanism for storing client data across multiple HTTP requests. From one request to another user the HTTP server does not maintain a reference or keep any record of client previous request. HttpSession Methods getAttribute : it returns stored value from session […]

TreeSet in Java

java-thumbnail

TreeSet class implements the Set interface and stores the data in tree structure. The values are stored in sorted and ascending oreder. It is quite fast in retrieval of elements. This makes TreeSet is most prefered choice for storing the large amount of data in sorted order and want to retrieve it fast. This supports […]

How To Sort Java Object Using Comparable And Comparator?

java-thumbnail

This tutorial shows how to use java.util.Comparator and java.lang.Comparable to sort a Java object based on its property value. Here I have created Employee object with Name and Age properties, we will be able to sort the list of objects based on the values in the property’ Lets look at the example. Employee.java ComparatorExample.java Output […]