4:02 pm - Saturday February 25, 2017

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

Inserts all of the elements in the specified collection into this list

BACK Example Program import java.util.ArrayList; public class Arrayad { public static void main(String args[]) { // create an empty array list1 with an initial capacity ArrayList arrlist = new ArrayList(5); // use add() method...

Program that returns number of elements in the Arraylist

BACK This Program is used to returns number of elements in the ArrayList Example Program import java.util.ArrayList; class Arraysize { public static void main(String[] args) { // create an empty array deque with an initial capacity ArrayList<Integer>...

Java Example Program for largest and smaller number in array

public class Array { /** * @ author: Candid @ Description: write a java program to find largest & * smallest number in an array */ public static void main(String[] args) { int a[] = new int[] { 5, 23, 45, 75, 10, 50, 7 }; int...

LinkedList example programs and Tutorial in java

BACK 1.Get size of LinkedList using  int size() 2.check whether  LinkedList is empty using boolean isEmpty() 3.check whether  LinkedList is empty using Another way boolean isEmpty() 4.check whether a value is present in LinkedList boolean...

clear all elements from treemap void Clear()

BACK                   This tutorial explains how to clear all elements from treemap using Clear() method.we can’t clear the particular data ,it will clear all the data. Example import java.util.TreeMap; public...

Retrieve value of given Key in Treemap V get(Object key)

BACK                      This tutorial explains how to Retrieve value of given Key in treemap using get(Object key) method.  Returns the value to which the specified key is mapped, or null if this map contains no mapping...

Combination of JSON primitives, Map and List

BACK                              This program explains about the combination of JSON primtives map and list.In addition output has been attached below. Example Program import java.io.FileWriter; import java.io.IOException; import...

Combination of JSON primitives, JSON object and JSON arrays

BACK                 This program explains about the combination of JSON primitives, json object and JSON arrays.In addition output has been attached below. Example Program import java.util.LinkedHashMap; import java.util.LinkedList; import...

JsonObject Example Program and Tutorial in Java

BACK                   1. Example Program using JSONObject                   2. Example program in JSONobject using Map                   3. Example program in JSONobject using Map and Streaming                  ...

Example program in JSONobject using Map

BACK                             This is a sample program which explains about  JSONObject using map and to addition  output of the program has been given below. Example Program import java.io.FileWriter; import...

check whether the given char sequence is equal to string boolean contentEquals(CharSequence cs)

                        This method returns true if and only if this string represent the same sequence of characters as the specified in buffer,otherwise false. Example Program public class Model1 { public static...

Compare equality of two string Ignoring case boolean equalsIgnoreCase(String anotherString)

                                                         Compares two strings lexicographically(compiling a dictionary order) Example Program public class Model1 { public static...

Replace first occurrence of a string for given regex String replaceFirst(String regex, String replacement)

                                This method is used to replace the first character of the string. First occurrence of the specified character will be replaced by new character. The character will be specified with...

Search index of a character from given position lastIndexOf(int ch,int fromIndex)

                                              This method returns the occurrence of the specified character within a specified range.If the specified character placed as many times within the specified range means then...

Search a position of a character from the last int lastIndexOf(int ch)

                      This method returns the last occurrence of the specified character in the given string  (i.e., it returns the occurrence position of the specified character). If the specified character placed number...

Struts 2 training

 Introduction o    What is MVC framework? o    Difference between Struts 1 and Struts 2 Architecture o    Environmental setup o    Flow and configuration o   Running a Hello world Example  Validation o   Form Validation...

Struts 2 Datepicker Example and Tutorial

BACK  Struts 2  Datepicker Example and Tutorial Datepicker.java package com.candidjava.controller; import com.opensymphony.xwork2.ActionSupport; public class Datepicker extends ActionSupport { private static final long serialVersionUID...

Struts 2 Validation using xml configuration Example and Tutorial

BACK Struts 2 Validation using xml configuration Example and Tutorial Validation-validation.xml <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> <field...

HashSet example program for Object[] toArray()

/** *@author:candidjava.com *@description: HashSet example program for Object[] to Array() */ import java.util.HashSet; public class HashSetObjectToArray { public static void main(String[] args) { HashSet hSet = new...