Advertisement
Dido09

StringToArray

Oct 13th, 2022
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. package Seminar1;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Scanner;
  5.  
  6. public class Upr3 {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         String[] names = new String[5];
  11.  
  12.         System.out.println("Enter a name: ");
  13.  
  14.         for (int i = 0; i < names.length; i++){
  15.             names[i] = scanner.nextLine();
  16.         }
  17.         System.out.println(Arrays.toString(names));
  18.  
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement