Arrays.toString not working in Java

탱귤생귤·2023년 7월 19일

ERROR

목록 보기
7/33
public class ProductValue {

	public static void main(String[] args) {
		//코드를 작성하세요.
		Scanner sc=new Scanner(System.in);
		
		System.out.println("몇 개 할지 적기 : ");
		int n=sc.nextInt();
		
		int[] goods=new int[n];
		
		for(int i=0;i<n;i++) {
			
			System.out.println("가격 적기 : ");
			int price=sc.nextInt();
			goods[i]=price;
		}
		
			Arrays.toString(goods);
		
	}

}

This didn't worked. Because!!!! I have to print out haha...

System.out.println(Arrays.toString(goods)); This works.

1개의 댓글

comment-user-thumbnail
2023년 7월 19일

가치 있는 정보 공유해주셔서 감사합니다.

답글 달기