Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Pick 1 or 2 ");
- int one_or_two = Integer.parseInt(sc.nextLine());
- if (one_or_two ==1){
- int[] massive1 = new int [3];
- for (int i = 0; i< massive1.length; i++) {
- int x = Integer.parseInt(sc.nextLine());
- massive1[i] = x;
- }
- System.out.println(Arrays.toString(massive1));
- } else if (one_or_two == 2){
- String[] massive2 = new String [3];
- for (int i = 0; i< massive2.length; i++) {
- String y = sc.nextLine();
- massive2[i] = y;
- }
- System.out.println(Arrays.toString(massive2));
- } else {
- System.out.println("Type one(1) or two(2)");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement