3:13 pm - Friday December 17, 1993

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

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...

Free Java training institute

Pay after you get placed (Java training) starts on 12th Feb 2015 At candid we provide java training and placement for 2013 and 2014 job seekers. Students will be given training in live projects both product and client based applications. There...

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 retain only elements specified in the specified collection using retainAll() method.

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<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...

Java Program used to get the name of parent file path using getParentFile() method.

BACK Get parent file program to get the name of parent file path. Example Program package service1; import java.io.File; public class ParentFilepath { public static void main(String[] args) { File f = null; File f1 = null; String...

Java Program used to find the parent Directory of the mentioned file using getParent() method.

BACK Get Parent program to find the parent Directory of the mentioned file. Example Program package service1; import java.io.File; public class GetParent { public static void main(String[] args) { File f = null; String v; boolean...

Java Program used to get the name of the file or directory mentioned in pathname using getName() method.

BACK String Getname program to get the name of the file or directory mentioned in pathname. Example Program package service1; import java.io.File; public class StrGetname { public static void main(String[] args) { File f = null; File...

Java Program get totalspace program to get size of a partition where abstract file exists using getTotalSpace() method

BACK Get totalspace program to get size of a partition where abstract file exists. Example Program package service1; import java.io.File; public class TotalSpace { public static void main(String[] args) { File f = null; long...

Java Program is used for memory optimization. It trims the capacity ofArrayList to the current list size using trimToSize() method

  BACK Java ArrayList trimToSize() Method exampletrimToSize() method is used for memory optimization. It trims the capacity ofArrayList to the current list size. Example Program import java.util.ArrayList; public class Trim { public...

Java Program returns an array containing all of the elements in this list in proper sequence (from first to last element) using T[] toArray(T[] a) method

BACK                  The java.util.ArrayList.toArray(T[]) method returns an array containing all of the elements in this list in proper sequence (from first to last element). Example Program import java.util.ArrayList; public...

Java Program returns an array containing all of the elements in this collection using Object[] toArray() method

BACK   Returns an array containing all of the elements in this collection. If the collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. Example...

Java Program is used to return a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive using subList(int fromIndex,int toIndex) method

BACK   The subList(int fromIndex,int toIndex) method is used to return a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive. The returned List is backed by this List, so changes in the returned List are...

Returns the number of unallocated bytes in the partition named by this abstract path name using long getFreeSpace()

BACK           These methods are useful when we want to write some data on disk and need to know howgetFreeSpace provides the available free space EXAMPLE PROGRAM import java.io.File; public class LongFreeSpace { public...