Sign up now
to enroll in courses, follow best educators, interact with the community and track your progress.
Arrays in Java (in Hindi)
570 plays

Lesson teaches how to create and use an array in Java

Saurabh Shukla
NIT Bhopal passout, passionate teacher, chess player, career counselor and an educator at

Unacademy user
china,uk,france,usa,russia are permanent members of unsc
There are three types of array : Instance, local static
  1. Arrays in Java Course: Java in Hindi for beginners By: SAURABH SHUKLA My

  2. About Me Saurabh Shukla Educator at and owner of MCA, NIT Bhopal-2006 O Teaching experience - 10 yrs contact: +91-9893194395 Share Email: sshukla, Recommen Rate Review

  3. Declaring arrays in Java O int arr[5]; //error O int arrl: int arr[]; int [] arr = new int[5]; int arr[] =new int[5]; int [ arr new in[5];

  4. Initializing during declaration int arrll-new int[l (2,4, 6, 8, 10]; int ari-new int[2] {2, 4, 6, 8, 10); //error int arr[]=new.nt[5](2,3,4,5,8); //error: you can not mention size and values together int arrll (2, 4, 6, 8, 10];

  5. Array is not blank int [larr-new int[3]; System.out.printin("arr[01:4arr[0]); arr length 3

  6. Find Error public class ArrayExample public static void main(String args[I) int arrll; arr[0]=25; arr 1] =50;

  7. Error public class ArrayExample public static void main(String args[I) Compile time error arr is blank int arr: arr[0]=25; arr(11-50; arr local variables when not initialized, they are blank

  8. Initialization after declaration public class ArrayExample public static void main(String args]) int arrl arr = new int[3]; arr new int[3]; arr[0]-10; arr[1]-20; arr[2]=30;

  9. User input import java.util. class ArrayExample1 public static void main(Stringl] args) import java.util.*; arr[o]-10 arr[1]-20 arr[2] = 30 arr[3]-40 arr 41-50 public static void main(Stringll args]-20 int []arr=new int[5]; Scanner sc-new Scanner(; System.out.println("Enter 5 numbers" for(int i=0;i<5;i++) arr[i]=sc.nextlnt(); for(int i=0;i<5;i++) System.out.printIn(''arr(''th" 4arr[i]);

  10. Thank You A programmer is a person who fix a problem that you don't know you have, in a way you don't understand"