0

Can anyone find the error?

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner name = new Scanner(System.in) Clients person[] = new Clients[5]; for(int e: person) e = name.nextLine(); } } public class Clients{ private final String client; public Clients(name1){ client=name1; } }

18th Sep 2021, 12:18 AM
Someone
6 Respuestas
+ 1
You have a few errors. You shouldn't try to use a for-in loop to (initialize) set objects to an array, but instead use a standard for loop. It's fine for reading from the array, or making changes to the objects after the array has been initialized with objects. Here's an example of what I believe you're trying to do; https://code.sololearn.com/c6BoLTK5XEAT/?ref=app
18th Sep 2021, 12:56 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Thank you very much✌✌✌
18th Sep 2021, 1:02 AM
Someone
+ 1
Thank you a lot Martin Taylor.....i need learn to read better the errors.
18th Sep 2021, 1:30 AM
Someone