Tag: core java
How To Convert ArrayList to String Array In Java
Hi friends, In java some times we may need some conversions from collection objects to some thing, ArrayList to String array is very popular conversion we are using in our projects 🙂 import java.util.ArrayList; import java.util.List; public class Java4s…
How to Remove Unwanted Characters From String in Java
Friends, sometimes we may need to remove some unwanted characters from our strings, some thing if we have mobile number for example (123)-456-7891, i want to remove ‘ – and () ‘ symbol before storing this field in the database then…
How to Create User Defined Exception in Java
Apart from existing Exceptions in java, we can create our own Exceptions (User defined exceptions in java), we will how to.. Required files Client.java MyOwnExceptionClass.java [ This is our own Exception…
How to Create Singleton Class in Java, Singleton Class in Java
Making java class as singleton is very important in some real time projects, we may need to have exactly one instance of a class. Suppose in hibernate SessionFactory should be singleton as its heavy weight, and some other Banking…
Static in Java, Static Variables, Static Methods, Static Classes
Static in java 🙂 very important concept in interviews. Let us see the story behind static variables and methods and classes in java classes…. Static Variables public class MyStatic { int var; static int var2; public static int methodStatic()…
Send Java EMail in Specific Time Interval Automatically & Dynamically
Let us see how to send automatic and dynamic email using Java, this application will send email in fixed interval of time, even if you want you can change this application to send email every day at particular time…
How to Remove Duplicate Values From Java List/ArrayList?
This is the question asked in our forum by some of our friend, even i faced this little issue once in my project 🙂 Some times we may not have chance to choose our own collection property. For example…
Creating PDF with Java and iText, Generating PDF Using Java Example
Its very important in real time to convert the records or any statements into PDF,EXCEL,Word,TXT and some other formats too 🙂 now i will tell you how to generate PDF using iTextPdf API (simple API to generate PDFs in…
Check the Character/First Character Of a String is Number or Not in Java
Let us see how to find whether the given Character of a String is a number or first Character of any String is a number or not ? CharNumber.java package java4s; public class CharNumber { public static void main(String……
Difference between Java Set, List and Map Collections?
Let us see the main differences between Set,List,Map java collections.. Set (Interface) Set is an un-ordered collection which doesn’t allows duplicate (no-duplicate) elements We can iterate the values by calling iterator() method Set s = new HashSet(); Iterator iter…
How to Sort Arrays in Java, Arrays Sorting In Java
Hi let us see how to sort array of values in java, we can sort the arrays using Arrays class in java.util.*; package. Consider the following example.. SortArray.java package java4s; import java.util.Arrays; public class SortArray { public static…
How to sort ArrayList in java, Sorting java Collections
Let us see how to sort values in java collections, List/ArrayList. We can achieve this by using Collections class, Collections class contains a method sort(Collection Object), just give your collection object to the sort() method that’s it, consider this…
Difference between Arraylist and Vector in Java
Hi friends, let us see the main differences between ArrayList and Vector collections, this is very important and common question in interviews for all IT people, hope you might face this question in your previous interviews 😉 Any how…
How to Generate Barcodes Using Java, Barcodes Example
Let us see how to generate Barcodes with java, we have different types of barcodes, among them i am going to explain about ‘Code 128‘ type 🙂 Files Required BarCode128Java4s.java iText.jar [ Make sure you have iText jar file…
How to Load Java Properties File Dynamically From the Classpath
Why this properties file ? if we are using any application where there is a chance of constantly changing any credentials, something consider any java email application or any there you may need to change from,to or any properties…
How to Install SVN(Subversion) Plugin in Eclipse, SVN in Eclipse
What/Why this SVN ? this is a changes management tool, forget 😉 i will explain in normal language :-). Consider you are working with XXXX project and have 5 members in your team. Every body is working on different…
What is servlet? An Introduction to Java Servlets
The basic aim of servlet is to develop web applications. Before servlets came into picture there was a specification called CGI. Servlets specification developed by SUN and released to the industry. Lot of server vendors came forward for implementing…
Steps to Write Java Servlet Program
Let us see the basic steps to develop java servlet application… Servlet program is not like, writing java code and execute through command prompt. We need to follow the following steps in order to develop any servlets program. Even…
How to Write Deployment Descriptor,web.xml In Servlet
This web.xml is like index of book, web.xml is containing details of static web resource programs and dynamic web resource programs. The purpose of web.xml is to hide to achieve the security for the web application by not…
How to Set Classpath For Servlet,setting Classpath For servlet-api.jar
As i told you in the previous article, we should set servlet-api.jar in our class path, in order to work with servlet applications. We cannot run servlet applications if you didn’t set servlet-api.jar. Where Can You Download servlet-api.jar You…
Servlet Hello World Example in Eclipse IDE with Tomcat Server
We will see the first servlet application directly in Eclipse IDE and i am using Tomcat 7, friends doing java servlet with out eclipse is really tedious 😉 we cannot do every thing individually and copying related files into…
Servlet Life Cycle in Java, Explanation of Servlet Life Cycle Methods
Aware of servlet life cycle is very important, before you going to execute first application. So let us see flow of life cycle methods… Java servlet will be executed in different stages, of which Loading the application and its…
Example on Servlet Life Cycle in Java
Let us see one example on servlet life cycle. Do you have any doubts related to the concept ? if so please check this Servlet Life Cycle theory article before you execute this example. Files required ServletLifeCycle.java web.xml Directory…
Java Servlet login Example In Eclipse
Let us discuss one simple login application using servlet and jsp, friends please refer previous articles if you still have any doubts regarding strvlets flow 🙂 Directory Structure Files Required OnServletLogin.java index.html web.xml index.html <form action=”login” method=”post”> <table> <tr>…