10:13 pm - Friday March 22, 2019

Archive: Z-A All Java Codes Subscribe to Z-A All Java Codes

Java Collections frequency example program

Here is a java example program for collections frequency operation in Collection c, Object o. The main function of this method is to get the frequency of an element present in the specified list of Collection. Here how to do java collections...

Java Program to Get Size of LinkedHashMap – Hashmap in Java

A LinkedHashMap is a combination of hash table and linked list. It has a predictable iteration order. Here simple java programming examples of getting hash map size in java.   import java.util.LinkedHashMap; class GetSizeOfLinkedHashMap...

Java Program for finding Fibonacci Serious numbers

Here is a simple java example program to find out the Fibonacci series of numbers. class Fibonacci { public static void main(String args[]) { System.out.println("How many numbers of the sequence would you like?"); InputStreamReader...

Java program for Find the Prime Numbers

In basics, Prime numbers are only divided by ‘1’ and number itself. At the same time, all the prime numbers are greater than ‘1’. Here is a simple prime number program in java with an example to find prime numbers from...

Check if a particular key exists in HashMap example

Here is an example program for checking  the key  which exists in a hashmap //*@author :CandidJava.com //*@descriptions : This program explain the function and use of Key method to find that the value is present or not import java.util.HashMap; class...

Hashtable Example program for values()

Here is the hash table sample program for values, in this sample hashtable program adding values within the double quotes as shown in the following example program.   *@author:candidjava.com *@description:hash table for values */ import...

The Collection Program sort the specified list

BACK   The sort(List<T>, Comparator<? super T>) method is used to sort the specified list according to the order induced by the specified comparator. Example Program import java.util.*; public class Comparator1 { static...

Java Collection Singleton Map examples

BACK   The singletonMap(K, V) method is used to get an immutable map, mapping only the specified key to the specified value. Example Program import java.util.*; public class Map1 { public static void main(String[] args) { Map<Integer,...

Java Program to retain only elements in the specified collection

BACK RetailAll program to retain only elements specified in the specified collection. Example Program import java.util.ArrayList; import java.util.LinkedList; public class RetainAll { public static void main(String[] args) { LinkedList...

Free Java training institute in Chennai

Free java training in Chennai (Learn Java and Pay after get placed)   At candid we provide Java training and placement for 2017 and 2018 job seekers Students will be given training in live projects both product and client-based applications. There...

Spring boot tutorial

Spring boot

Java training course content

Java Training Course content Java Preview Java Developer Kit Java Virtual machine Java Runtime Environment Just in time Compiler Compiler vs. Interpreter Java bean Standards Advantages and disadvantages of java Java Configuration Introduction...

Java Program used to remove the specified element in the list using remove() method

BACK   Remove Index example program to remove the specified element in the list. Example Program import java.util.ArrayList; public class RemoveIndex { public static void main(String[] args) { ArrayList al = new ArrayList(); al.add(“0”); al.add(“1”); al.add(“2”); al.add(“3”); System.out.println(“Arraylist...

Java Program used to ensure the minimum capacity of arraylist

BACK   The java.util.ArrayList.ensureCapacity(int minCapacity) method increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument. Example...

Java Program used to create copy of an object using clone() method.

BACK The java.lang.Object.clone() creates and returns a copy of this object Example Program import java.util.GregorianCalendar; public class Clone { public static void main(String[] args) throws CloneNotSupportedException { // create...

Java Program used to iterate the elements in the arraylist and display using iterator() method

BACK Iterator program to iterate the elements in the arraylist and display Example Program import java.util.ArrayList; import java.util.Iterator; public class Iterater { public static void main(String[] args) { ArrayList<String>...

Java Program used to to remove the specified element in the list using remove() method

BACK Remove Index program to remove the specified element in the list Example Program import java.util.ArrayList; public class RemoveIndex { public static void main(String[] args) { ArrayList al = new ArrayList(); al.add(“0”); al.add(“1”); al.add(“2”); al.add(“3”); System.out.println(“Arraylist...

Java Program used to ensure the minimum capacity of arraylist using ensureCapacity() method

BACK  EnsureCapacity program to ensure the minimum capacity of arraylist Example Program import java.util.ArrayList; public class EnsureCapacity { public static void main(String[] args) { ArrayList<String> al = new ArrayList<String>(); al.add("10"); al.add("30"); al.add("60"); al.add("70"); al.add("80"); al.add("90"); al.add("10"); al.add("20"); al.add("100"); al.ensureCapacity(8); for...

Java Program used to create copy of an object using clone() method

BACK Object Clone program to create copy of an object Example Program import java.util.GregorianCalendar; public class Clone { public static void main(String[] args) throws CloneNotSupportedException { // create a gregorian calendar,...

Java Program used to get the pathname of the file using getPath() method

BACK Get Filepath program to get the pathname of the file. Example Program package service1; import java.io.File; public class StrFilepath { public static void main(String[] args) { File f = null; String v; boolean bool...