write a program to store 10 names in an array and then print the names stored in that array .
Answers
Answered by
0
Answer:
import java.util.*;
public class Array
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.println("Enter no. of elements you want in array:");
int n = s.nextInt();
String a[] = newString[n];
System.out.println("Enter the names:");
for(int i = 0; i < n; i++)
{
a[i] = s.nextline();
}
System.out.println(a[i]);
}
}
Similar questions