In: Computer Science
Write the code to create an array named movies and store three of your favorite movies in the array. Only provide the array and code needed to put the movie names in the array. Do not include additional code
hey there ! i am done with the code using java ,, Please give me a like to appreciate my work and efforts ,,your like means a lot !
here is the syntax for array declaration -
Type arrayname[]=new Type[size];
for example -
String array[]=new String[3];
here is the code and snapshot of the output ---
public class Arraycheck {
public static void main(String args[])
{
//declaring and initializing an array type of string to store the
movies name :
String array[]=new String[3];
//storing the movies name by manually --
array[0]="MSD";
array[1]="DILBechara";
array[2]="Kaipoche";
//print the array :
for(int i =0;i<array.length;i++)
{
System.out.println(array[i]);
}
}
}
and snapshot ---
Thank You !