Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Array

Deepthi's picture

Java Reverse Array

3.6
Your rating: None Average: 3.6 (5 votes)
Write a Java program to reverse an array without creating another array.
  1. //Java Reverse Array
  2. public class JavaReverseArray {
  3.    
  4.     public static void main(String args[]){
  5.        
  6.         //declare an array
  7.         int[] numbers = {1,2,3,4,5};
  8.        
  9.         System.out.println("Java array before reverse");
  10.         for(int i=0; i < numbers.length ; i++){
  11.          
Sameera's picture

Java Array of ArrayLists

0
Your rating: None
This Java example shows how to create array of ArrayLists and use it.
  1. import java.util.ArrayList;
  2.  
  3. //Java Array of ArrayLists
  4.  
  5. public class ArrayOfArrayList {
  6.    
  7.     public static void main(String args[]){
  8.        
  9.         //create an array of ArrayList
  10.         ArrayList[] aListClothSizes = new ArrayList[2];
  11.        
  12.         ArrayList<String> aListShirtSizes = new ArrayLis
Ragi Patel's picture

Java ArrayList to Array

0
Your rating: None
This small Java example shows how to convert ArrayList to array using toArray method of Java ArrayList class.
  1. import java.util.ArrayList;
  2.  
  3. //Java ArrayList to Array using toArray method
  4. public class JavaArrayListToArray {
  5.  
  6.     public static void main(String args[]){
  7.        
  8.         //create new ArrayList
  9.         ArrayList<String> aListColors = new ArrayList<String>();
Bharat's picture

Java Array to Vector

Hi All,

Another question :). I want to convert Java array to Vector object. Any help is appreciated. Any example to convert Java array to Vector?
0
Your rating: None
Bharat's picture

Java Vector to Array

I have a vector object whi
0
Your rating: None
Andr's picture

Anonymous Array

3.285715
Your rating: None Average: 3.3 (7 votes)
Anonymous Array

In java it is perfectly legal to create an anonymous array using the following syntax.

new <type>[] { <list of values>};

Anonymous array example

new int[]{1,2,3};
Andr's picture

Multidimensional Array Example, Java Array Tutorial

0
Your rating: None
Java Multidimensional Array Example
Andr's picture

Multidimensional Array, Java Array Tutorial

0
Your rating: None
Java Multidimensional Array

In java, multidimensional (array of arrays) can be defined using following syntax.

<type> arrayName[]…[];
or
<type>[]…[] arrayName[];

Where []…[] denotes number of dimension.
Andr's picture

Accessing Array Elements, Java Array Tutorial

0
Your rating: None
Accessing elements of an array

Individual elements of an array can be accessed by specifying index with [] operator, with the following syntax.

arrayName[<index>]
Andr's picture

Java Array Initialization

2
Your rating: None Average: 2 (1 vote)
Java Array Initialization

Once created, array elements can be initialized explicitly using loop or initialization can be combined with the array creation using following syntax.

<type>[] arrayName = { <initialization value list>};

Following is the example of the same.

int [] myIntArray = {1,2,3,4};
Syndicate content