Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- // TODO code application logic here
- Scanner in = new Scanner(System.in);
- System.out.println("Hello user");
- //Input the size of array
- int size;
- System.out.print("Type the array' size: ");
- size = in.nextInt();
- //Declaration of the array
- String[] array = new String[size];
- int i;
- //input the elements
- for(i=0; i<size;i++){
- System.out.println("Type a Name: ");
- array[i] = in.nextLine();
- }
- //print the elements
- for(i=0;i<size;i++){
- System.out.println("The element "+(i+1)+" is: "+array[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement