Friday, March 29, 2013

StringTokenizer Example

StringTokenizer Example: StringTokenizer is the class in java.util package. The use of StringTokenizer class is breaks the given string into number of tokens based on the delimiter. Here i am giving the very simple StringTokenizer Example. you can easily understand the below code. In the below example, i am using the delimiter as ';' While creating the StringTokenizer object I am passing the given string and the delimiter. By using the countTokens() method, will get the total number of tokens. String Tokenizer Sample code import java.util.StringTokenizer;...

Wednesday, March 20, 2013

Java HashMap Example

Java HashMap Example : HashMap is the class in java.util package, The main advantage of HashMap is to store the information in the form of Key/Value pairs. In this HashMap Object we can store the null values also. that means the HashMap accepts to store the null values as key/value pairs. Suppose you are retrieving the data from the database, if some records are returned with null values. you can store these null values also in this HashMap object. HashMap is not synchronized. Below is the very straight and quick start example for HashMap. The...

Sunday, March 17, 2013

Java ArrayList Example

Java ArrayList Example : Java ArrayList Example, I am giving very straight, short and easy description, you can straight away use this in your Code. ArrayList : You can find this ArrayList class in java.util package. There are lot of methods available to manipulate ArrayList Object. The advantage of ArrayList is to store the different kind of objects, either string or user defined class objects. In the below i am giving the ArrayList Example how you can store the String Objects and again get the objects from that ArrayList object. Here i...

Thursday, March 14, 2013

Core Java Samples

Hello World Example                                   LinkedHashSet Example Java ArrayList Example                               Java static import Java HashMap Example                               Java String StringTokenizer Example               ...

Hello World Example

Java Hello World Example  It is very simple in java to write the Hello World Example. In this Example, We just print the Text as Hello World Example on the console after executing this Program. The below Example is very straight forward example, take the below code and just compile using from the  command prompt or you can use any tools like eclipse. Use the Javac command to compile the java program, for Example Javac HelloWorld.java. Once you compile this program, the Java compiler compiles and generates the .class file....

Monday, March 11, 2013

Java Interview Questions

  if(null==null){ System.out.println("Both are equal");           }else{ System.out.println("Both are not equal");           }                    What is the output for the above code?           Output : Both are equal. Difference between finally and finalize? What is cloning? what is deep and shallow cloning? How to do deep cloning? How you write the program to read the...

 
Disclaimer : If you find any mistakes / corrections / feedback Please let us know...This website author shall not accept liability or responsibility for any errors, mistakes or misstatements found in this website.