0

what am i doing wrong ?

//Prints true if the given m = month and d = day fall between // March 20 (inclusive) and June 20 (inclusive) public class IsaSpringDay { public static void main(String[]args) { int m = Integer.parseInt(args[0]); int d = Integer.parseInt(args[1]); if (m >= 3 && m <= 6 && d <= 20){ System.out.println("True"); } else { System.out.println("False");}

8th Sep 2020, 3:30 AM
Moses Mercado
Moses Mercado - avatar
3 ответов
+ 1
hey, Your code is absolutely right but.you forgot to complete main method and class so } } add this 2 brackets to your code. If you want to run your code online refer following site: Pass Command line argument (day and Month) and Check output https://www.jdoodle.com/online-java-compiler/
8th Sep 2020, 3:55 AM
AjayGohil
0
but what if the month is 5 and the day is 21 my code wouldn't include it when it should.
8th Sep 2020, 5:04 AM
Moses Mercado
Moses Mercado - avatar
0
Swith case better works here.. Cases for months Or go if else.. If month ==3,then date must not less than 20 if month ==6 then date shloud not greater than 20.. Else only check month is between 3 and 6 or not.. Or java has time and with limitations with date classes, learn about those....
8th Sep 2020, 12:02 PM
Jayakrishna 🇮🇳