int d = Integer.parseInt(s); my program is giving errors in this line. calling it invalid format.
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String s = r.readLine();
int d = Integer.parseInt(s);
if(d==1){
System.out.println("Monday");
}
else if(d==2){
System.out.println("Tuesday");
}
else if(d==3){
System.out.println("Wednesday");
}
else if(d==4){
System.out.println("Thursday");
}
else if(d==5){
System.out.println("Friday");
}
else if(d==6){
System.out.println("Saturday");
}
else if(d==7){
System.out.println("Sunday");
}
else if((d<=0||d>=8))
{
System.out.println("there is no such day of the week");
}
}
}
what is wrong in this program
please help
package com.codegym.task.task04.task0413;
/*
Day of the week
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String s = r.readLine();
int d = Integer.parseInt(s);
if(d==1){
System.out.println("Monday");
}
else if(d==2){
System.out.println("Tuesday");
}
else if(d==3){
System.out.println("Wednesday");
}
else if(d==4){
System.out.println("Thursday");
}
else if(d==5){
System.out.println("Friday");
}
else if(d==6){
System.out.println("Saturday");
}
else if(d==7){
System.out.println("Sunday");
}
else if((d<=0||d>=8))
{
System.out.println("there is no such day of the week");
}
}
}