3:11 pm - Monday November 25, 8689

Tag Archives: sample code

FileInputStream example program for available() in java

/** * @author : candidjava * task : FileInputStream example program for available() in java */ import java.io.FileInputStream; class FIStream { public static void main(String[] args) { try { FileInputStream fi = new FileInputStream("sample.txt");//...

FileInputStream

FileInputStream example program for available() in java FileInputStream example program for close() in java FileInputStream example program for skip(long n) in java BACK

BufferedInputStream example program for reset() in java

/** * @author: candidjava * @description: in JAVA example program for */ import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class BufferedInputStreamDemo...

Calendar in java example program get Instance(TimeZone zone, Locale aLocale)

/** *@author:candidjava.com *@description: Calender in java example program getInstance(TimeZone zone,Locale aLocale) */ import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; public class CalendarGetInstance { public...

Calendar in java example program clear()

/** *@author:candidjava &@description:Calendar in java example program for clear() **/ import java.util.Calendar; public class CalendarClear { public static void main(String[] args) { // create calendar object Calendar cal...

Date in java example program for set Time(long time)

/** @author:candidjava @description:Date in java example program for setTime(long time) */ import java.util.Date; public class MyClass { public static void main(String[] args) { Date d=new Date(); d.setTime(-1332403); System.out.println(d); } } Output: Thu...

Date in java example program for equals(Object obj)

/** *@author:candidjava .@description:Date in java example program for equals(Object obj) **/ import java.util.Date; public class Equals { public static void main(String[] args) { Date date = new Date(55, 6, 30); Date date2 = new...

Date in java example program for clone()

/** *@author:candidjava *@description:Date in java example for clone() **/ import java.util.Date; public class Clone { public static void main(String[] args) { Date d1 = new Date(90,10,5); Object d2=d1.clone(); System.out.println("Original...

Date in java example program for after(Date when)

/**@author:candidjava *@description:Date in java example program for after(Date when) **/ import java.util.Date; public class After { public static void main(String[] args) { Date d1 = new Date(11, 5, 21); ...

Currency in java example program for getSymbol()

/** *@author: candidjava *@description: Currency in JAVA example program for getSymbol() **/ import java.util.Currency; public class Getsymbol { public static void main(String[] args) { // create a currency for euro Currency curr...

Collections Example program for frequency(Collection c, Object o)

@author:Candid @discription:Collections Example program for frequency(Collection c, Object o) **/ import java.util.List; import java.util.ArrayList; import java.util.Collections; public class Freq { public static void main(String...

Collections example program forbinarySearch(List> list, T key)

import java.util.List; public class Bsearch { public static void main(String args[]) { String simpsons[] = { "Ball", "House", "Lime", "Moon", "Head", "Mani", "Rabbit"...

Hashtable Example program for values()

/** *@author:candidjava.com *@description:hash table for values */ import java.util.Hashtable; public class Hashtable { public static void main(String[] args){ Hashtable h=new Hashtable(); h.put(2,"3"); //to...

Hashtable Example program for values()

*@author:candidjava.com *@description:hash table for values */ import java.util.Hashtable; public class Hashtable { public static void main(String[] args){ Hashtable h=new Hashtable(); h.put(2,"3"); //to add first value h.put(3,"4"); //to...

Hashtable Example program for rehash()

*@Author:CandidJava.com</span> *@Description:automatically increase the capacity of the hashtable */ import java.util.Hashtable; public class ReHash1 { public static void main(String args[]) {//rehash method is automatically called Hashtable...

Hashtable Example program for putAll(Map t)

// Hashtable Example program for putAll(Map t) /** @author: candidjava.com @description: This method is used to copy all of the mapping elements to the specified  Hashtable. */ import java.util.*; class Case { public static void main(String[]...

Hashtable Example program for containsKey(Object key)

/** *@author:kingsley *@description:Hashtable Example program for ContainsKey */ import java.util.Hashtable; class HashTableExam { public static void main ( String[] args ) { Hashtable ht=new Hashtable(); // creating...

Hashtable Example program for clone()

// Hashtable Example program for clone() /** @author: candidjava.com @description: This program gives the copy of the existing Hashtable. */ import java.util.*; public class Clone { public static void main(String[] args) { Hashtable...

LinkedList Example Program for toArray(T[] a)

//program name: LinkedList Example Program for toArray(T[] a) /** @ author:candidjava.com @description: Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of...

LinkedList Example Program for toArray()

/** *LinkedList Example Program for toArray() * @author   candidjava.com * @description:  Returns an array containing all of the elements in this list in proper sequence (from first to last element). */ import java.util.*; public...