+ 3

What's the problem???

import java.util.*; public class Aaa { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("please enter an enteger: "); int n = input.nextInt(); String day; if (n == 1) { day = "sunday"; } elseif (n == 2); { day = "monday"; } elseif (n == 3); { day = "tuesday"; } elseif (n == 4); { day = "wednesday"; } elseif (n == 5); { day = "thursday"; } elseif (n == 6); { day = "friday"; } elseif (n == 7); { day = "saturday"; } else { day = ""; } if (day != "") { System.out.format("The day #%d in week is %s.\n",n ,day); } else { System.out.println("You have entered an invalid number."); } } }

5th Jan 2021, 2:59 AM
Amateur
4 Respostas
+ 7
No worries! All experienced developers were amature once. 😊 Keep coding and you'll see you're improving 📈
5th Jan 2021, 3:13 AM
Minho
Minho - avatar
+ 6
https://code.sololearn.com/cGBfQzYi95tB/?ref=app You should attach your code here. Instead of writing it in the description. Here is the fixed code. https://code.sololearn.com/cv61Wi70z7Kk/?ref=app 1. It's else if not elseif 2. And you should remove the semi-colon after each else if statement.
5th Jan 2021, 3:07 AM
Minho
Minho - avatar
+ 3
I'm amateur so much😅 Thanks for your help
5th Jan 2021, 3:10 AM
Amateur
+ 2
Sure!👌
5th Jan 2021, 3:14 AM
Amateur