11:15 pm - Sunday February 19, 2017

Tag Archives: code examples

LinkedList Example Program for pollFirst()

/** *@author: candidjava.com *@description: coding  for linked list poll method */ import java.util.LinkedList; public class LinkedListDemo { public static void main(String[] args) { // create a LinkedList LinkedList list =...

LinkedList Example Program for addAll(Collection c)

/*Program Name: LinkedList Example Program for addAll using int index, Collection c*/ /** *@Author: Candidjava.com *@Description:LinkedList Example Program for addAll (int index, Collection c) Program is used to Inserts all of the elements...

LinkedList Example Program for addAll(int index, Collection c)

/*Program Name: LinkedList Example Program for addAll using int index, Collection c*/ /** *@Author: Candidjava.com *@Description:LinkedList Example Program for addAll (int index, Collection c) Program is used to Inserts all of the elements...

Vector Example Program for hashCode()

/** @AUTHOR:candid java.com @DESCRIPTION:: Returns the hash code value for this Vector. */ import java.util.Vector; public class Hash { public static void main(String args[]) { Vector v1 = new Vector(); v1.add("A"); ...

Vector Example Program for add(E e),

/** @AUTHOR:candid java.com @DESCRIPTION: Inserts the specified element at the specified position in this Vector. */ import java.util.Vector; public class Add { public static void main(String args[]) { Vector v = new Vector(); ...

Vector Example Program for capacity()

/** @AUTHOR:Candid java.com @DESCRIPTION:Program for print the capacity of the vector */ import java.util.Vector; public class Capacity { public static void main(String[] args) { Vector v1=new Vector(); Vector v2=new Vector(4); Vector...

Vector Example Program for addElement(E obj)

/** @AUTHOR:Candid java.com @DESCRIPTION: Adds the specified component to the end of this vector, increasing its size by one */ import java.util.Vector; public class AddElements { public static void main(String args[]) { Vector v...

Vector Example Program for clear()

/** @ AUTHOR:Candid java.com @ DESCRIPTION:coding for clear the elements in the vector */ import java.util.Vector; class Clear { public static void main(String[] args) { Vector v = new Vector(); v.add("One"); v.add("Two"); v.add("Three"); v.add("Four"); v.clear(); System.out.println("Size...

DOUBLE Example Programs

Double Example Program for doubleValue()  ________________________________________________________________________________________________________  Double Example Program for floatValue()  ________________________________________________________________________________________________________ Double...

Double Example Program for doubleValue()

/** @AUTHOR: candid java.com @DESCRIPTION: coding for convert into double value */ public class DoubleValue { public static void main(String[] args) { Float f = 35.45f; double d = f.doubleValue(); //convert float...

Math Example Program for nextUp(float f)

/** @AUTHOR: candid java.com @DESCRIPTION: coding for get the next float larger than the given float value */ public class NextUp { public static void main(String args[]) { float f=97.33f; System.out.println(Math.nextUp(f));//Returns...

HashMap Example program for values()

/** Author :candidjava.com Description: It returns a collection object of HashMap values. */ import java.util.*; public class HashMapValues { public static void main(String arg[]) { HashMap<Integer, String> osHashMap = new...

HashMap Example program for size()

/** Author :candidjava.com Description: total number of keys in HashMap. */ import java.util.*; public class HashMapSize { public static void main(String arg[]) { HashMap<Integer, String> osHashMap = new HashMap<Integer,...

HashMap Example program for remove(Object key)

/** Author :candidjava.com Description: It removes a value of specific key from HashMap. */ import java.util.*; public class HashMapRemove { public static void main(String arg[]) { HashMap<Integer, String> osHashMap = new HashMap<Integer,...

HashMap Example program for keySet()

/** Author :candidjava.com Description: It returns a Set of keys of HashMap. */ import java.util.*; public class HashMapkeySet { public static void main(String arg[]) { HashMap<Integer, String> osHashMap = new HashMap<Integer,...

HashMap Example program for isEmpty()

/** Author :candidjava.com Description: Returns true if this map contains no key-value mappings. */ import java.util.*; public class HashMapEmpty { public static void main(String arg[]) { HashMap<Integer, String> osHashMap...

Long Example Program for toHexString(long i)

/** @author:candidjava @desription:This example shows how Integer value can be changed to Hexa String. */ public class IntegerToStringHexa { public static void main(String[] args) { int a=78; System.out.println("Integer:"+a); String...

Math Example Program for min(int a,int b)

/** @author:candidjava @description:This example shows how find the small integer from math method */ public class MinInt { public static void main(String[] args) { int a=89; int b=97; System.out.println("Large int is:...

Math Example Program for min(float a,float b)

/** @author:candidjava @desription: This example shows how find the small float from math method */ public class SmallFloat { public static void main(String[] args) { float a=12.45f; float b=12.4567f; System.out.println("small...

StringBuilder Example Program for length()

/** *@author :CandidJava.com *@descriptions : This program explain the function and use of length(). It is used to find length of the string . */ import java.lang.*; public class StrBuilderlength { public static void main(String args[]) { StringBuilder...