1 / 4

Arrays

An array is a group of homogeneous(same type) elements,It will not support heterogeneous(another type) elements.<br>for more free learning visit:<br>https://quipoin.com/view/Java/Overview

Prince89
Download Presentation

Arrays

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Arrays Arrays in JAVA

  2. Overview • An array is index-based, and the index number starts from 0. • Array generally supports the same type of elements we cannot store different types of elements in the array. • If the array has a fixed size length it will not grow dynamically. • Array doesn't support any standard data structure it always stores elements linearly. • Array doesn't provide any inbuilt algorithms for searching and sorting. • If we don't know the number of elements and type of element we want to store non-linearly then we go for Data-Structures (In Java we call them Collections).

  3. Program public class ArrayDemo1 { public static void main(String[] args) { int[] a1= new int[5]; System.out.println("Size of the array:"+a1.length); a1[0]=10; a1[1]=15; a1[2]=20; a1[3]=25; a1[4]=30; System.out.println("---------------------"); System.out.println("Elements of an array:"); for(int i=0;i<a1.length;i++) { System.out.println(a1[i]); } System.out.println("---------------------"); } }

  4. Structure

More Related