Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Blogs

Andr's picture

Java Date Example

1
Your rating: None Average: 1 (1 vote)
  1. /*
  2. Java Date example.
  3. This Java Date example describes how Java Date class
  4. is being used in Java language.
  5. */
  6.  
  7. import java.util.*;
  8.  
  9. /*
  10. Most of the methods of the Java Date class have been deprecated.
  11. Java Calendar class should be used for date manipulation instead.
  12. */
  13.  
  14. public class JavaDateExample{
  15.    
  16.     public static void main(String args[]){
  17.        
  18.         /*
  19.        
Andr's picture

Java String valueOf Example

0
Your rating: None
  1. /*
  2. Java String valueOf example.
  3. This Java String valueOf example describes how various Java primitives
  4. and Objects are converted to Java String object using String valueOf method.
  5.  
  6. */
  7.  
  8. public class JavaStringValueOfExample{
  9.    
  10.     public static void main(String args[]){
  11.        
  12.         /*
  13.         Java String class defines following methods to convert various
  14.         Java prim
Andr's picture

Java String Split Example

4
Your rating: None Average: 4 (8 votes)
  1. /*
  2. Java String split example.
  3. This Java String compare example describes how Java String is split into
  4. multiple Java String objects.
  5. */
  6.  
  7. public class JavaStringSplitExample{
  8.    
  9.     public static void main(String args[]){
  10.        
  11.         /*
  12.         Java String class defines following methods to split Java String object.
Andr's picture

Java String Compare Example

5
Your rating: None Average: 5 (1 vote)
  1. /*
  2. Java String compare example
  3. This Java String compare example describes how Java String is
  4. compared with another Java String object or Java Object.
  5. */
  6.  
  7. public class JavaStringCompareExample{
  8.    
  9.     public static void main(String args[]){
  10.    
  11.         /*
  12.         Java String class defines following methods to compare Java String object.
  13.        
  14.         1) int compareTo(String
Andr's picture

Java String Substring Example

4.333335
Your rating: None Average: 4.3 (12 votes)
  1. /*
  2. Java substring example.
  3. This Java substring example describes how substring method of
  4. Java String class can be used to get substring of the given Java string object.
  5. */
  6.  
  7. public class JavaSubstringExample{
  8.    
  9.     public static void main(String args[]){
  10.        
  11.         /*        
  12.         Java String class defines two methods to get substring from the given
  13.         Java String
Andr's picture

Java String Replace Example

3.9
Your rating: None Average: 3.9 (10 votes)
  1. /*
  2. Java String replace example.
  3. This Java String Replace example describes how replace method of java String
  4. class can be used to replace character or substring by new one.
  5. */
  6.  
  7. public class JavaStringReplaceExample{
  8.    
  9.     public static void main(String args[]){
  10.        
  11.         /*
  12.         Java String class defines three methods to replace character or
  13.         substring from th
Andr's picture

Java String Example

0
Your rating: None
  1. /*
  2. Java String example
  3. This Java String example describes how Java String object is created and used.
  4. */
  5.  
  6. public class JavaStringExample{
  7.    
  8.     public static void main(String args[]){
  9.        
  10.         /*
  11.         String in java represents the character sequence.
  12.         */
  13.        
  14.         //creates new empty string        
  15.         String str1 = new String("");
  16.    
Andr's picture

Java Comparator Example

4.30769
Your rating: None Average: 4.3 (104 votes)
  1. package examples;
  2.  
  3. /*
  4. Java Comparator example.
  5. This Java Comparator example describes how java.util.Comparator
  6. interface is implemented to compare Java custom class objects.
  7.  
  8. This Java Comparator is passed to Collection's sorting method
  9. (for example Collections.sort method) to perform sorting of Java custom
  10. class objects.
  11.  
  12. */
  13.  
  14. import java.util.*;
  15.  
  16. /*
  17. java.util.Comparator
Andr's picture

Java Comparable Example

4.19231
Your rating: None Average: 4.2 (26 votes)
  1. /*
  2. Java Comparable example.
  3. This Java Comparable example describes how java.util.Comparable
  4. interface is implemented to compare user defined classe's objects.
  5. */
  6.  
  7. import java.util.*;
  8.  
  9. /*
  10. Comparable interface is used to make user defined class's objects comparable.
  11. This interface declares one method compareTo(Object object)
  12. and determines how objects can be compared to wit
Andr's picture

Java Iterator Example

3.75
Your rating: None Average: 3.8 (12 votes)
  1. /*
  2. Java Iterator example.
  3. This Java Iterator example describes how Iterators are used with Collections.
  4. */
  5.  
  6. import java.util.Iterator;
  7. import java.util.HashMap;
  8.  
  9. public class IteratorExample{
  10.    
  11.     public static void main(String args[]){
  12.    
  13.         HashMap hashMap = new HashMap(); // Constructs a new empty HashMap
  14.        
  15.         hashMap.put("One", new Integer(1
Syndicate content