Hello there :(happy): .I am new to java programming and i need help with creating an array of objects.The related codes are the following:
public class Shop {
public static final int NUM_CASHIERS=10;
Cashier[] totalcashiers=new Cashier[NUM_CASHIERS];
for(int j=0; j<=1; j++) {
totalcashiers[j]= new Cashier(true);
}
public class Cashier {
private boolean open;
private ClientQueue queue;
Client currentClient;
int serviceTime;
int idleTime;
public Cashier(boolean open) {
this.open=open;
}
I have to create an array of the class Cashier in the class shop.The max size of the array is 10.In the beginning , i have to create two cashier objects that are open and that is what i am trying to do in the for loop.The error that i need help with is in the 4th line of the class Shop.
error: illegal start of type
for(int j=0; j<=1; j++) {
error: ')' expected
for(int j=0; j<=1; j++) {
error: illegal start of type
for(int j=0; j<=1; j++) {
error: <identifier> expected
for(int j=0; j<=1; j++) {
error: ';' expected
for(int j=0; j<=1; j++) {
error: illegal start of type
for(int j=0; j<=1; j++) {
error: <identifier> expected
for(int j=0; j<=1; j++) {
error: <identifier> expected
for(int j=0; j<=1; j++) {
error: illegal start of type
for(int j=0; j<=1; j++) {
error: <identifier> expected
for(int j=0; j<=1; j++) {
error: ';' expected
Any help is appreciated.Thanks in advance.

