Question
how would i print out the arrays Names and Gifts it keeps giving me an error when I try to use Arrays.toString(name)); import java.util.Scanner; import
how would i print out the arrays Names and Gifts it keeps giving me an error when I try to use Arrays.toString(name));
import java.util.Scanner; import java.util.Arrays; public class DSassignment1 { void arrays() { Scanner kb = new Scanner(System.in); String[] names = new String[15];
System.out.println("enter friends names | type *END* when done"); for(int i = 0; i < names.length; i++){
String in = kb.nextLine(); names[i] = in; if(in.equals("*END*")){ break;} }
String[] gifts = new String[15]; System.out.println("enter gift names | type *END* when done"); for(int j = 0; j < gifts.length; j++){ String in = kb.nextLine(); gifts[j] = in; if(in.equals("*END*")){ break;} } for( int j=1; j
public static void main(String[] args) { DSassignment1 lab = new DSassignment1(); lab.arrays(); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started