Hi i am new to java and just learning as i go , I the basic of calling mothod arguments and so forth but i am having difficulties calling my array method so it would come up to the terminal to the user when the code is running .
i have declared the array list paramter to ( int [] name ) , then called the array MyObject.MyMethod ( 01234 ) . I tried to return the array list then call the method that way but is not worrking please can some one show me the correct way to implement this using my code example below
public static void main(String[] args) {
BookingController details = new BookingController ();
() // PLEASE SHOW ME HERE HOW TO CALL THE ARRAY
}
public int lessonsList( /// PLEASE SHOW ME IN HERE WHAT PARAMTER I HAVE TO DECLARE FOR ARRAY LIST ) {
final int lESSON_COUNT = 4;
System.out.println("###############################################");
System.out.println("PLEASE SELECT LESSON");
System.out.println("###############################################");
String[] lessonList = new String[lESSON_COUNT]; // new string of name of 3
lessonList[0] = "Zumba";
lessonList[1] = "Spin";
lessonList[2] = "Yoga";
lessonList[3] = "BodyScuplt";
for (int i = 0; i < lESSON_COUNT; i++) {
System.out.println((i + 1) + ". " + lessonList[i]);
}
System.out.println("Please select the values between 1-3 to book lessons");
int y = sc.nextInt();
y -= 1;
System.out.println("You have selected lesson " + lessonList[y]);
sc.nextInt();
if (y > lESSON_COUNT | y < 1) {
System.out.println("Can you please re-enter selection.");
}
y = sc.nextInt();
System.out.println((y + 1) + ". " + lessonList[y]);
return y;
}
}