+ 3

What is the use of array in java

i am confused in array

26th Apr 2018, 2:49 AM
JATIN $HARMA
JATIN $HARMA - avatar
6 Answers
+ 10
JATIN SHARMA example: suppose if you want to use 10 num in your program and think you have no array concept then what you did?? you declare 10 int variable and use this variable in your program. but here the problem is every time you set every variable or access every variable one by one like: example: without using array: int a=10; int b=20; int c=30; ... ... int z=240; System.out.println(a); System.out.println(b); System.out.println(c); ... ... ... System.out.println(z); with array: int array1[]=new int[10]; for(int i=0;i<array.length;i++) { array1[i]=i;//or any value System.out.println(array1[i]); } also without array concept some time its create bad complexity trade-off(time-space both) i think this one help you
26th Apr 2018, 4:10 AM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 9
JATIN SHARMA welcome if you find any problem in my explanation please say i will explain again thank you ā˜•ā˜•
27th Apr 2018, 12:14 AM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 3
array are use in Java like any other programming language to store set of data values in index element and they are mostly use to large set of data. Example students grade, names of student etc
27th Apr 2018, 12:58 AM
Ugoson Paul
Ugoson Paul - avatar
+ 2
thanks asif
26th Apr 2018, 6:24 AM
JATIN $HARMA
JATIN $HARMA - avatar
+ 1
thanks droftor
26th Apr 2018, 3:16 AM
JATIN $HARMA
JATIN $HARMA - avatar