0

Why this code is Giving error in sololearn compiler environment?

I have tried this code in my Eclipse and its executed successfully and giving the desired result. But sololearn compiler is giving Error for the whitespaces : IllegalArgumentException And for type conversion also.

12th Mar 2020, 9:06 AM
Shivam Srivastava
Shivam Srivastava - avatar
6 Antworten
+ 2
https://code.sololearn.com/cm9bCt72ZzpR/?ref=app this is your code . when we copy and paste the code extra space added in our code and solo learn read this spaces to character.
12th Mar 2020, 9:18 AM
Prathvi
Prathvi - avatar
+ 1
when we copy and paste the code extra space added in our code and solo learn read this spaces to character.
12th Mar 2020, 9:20 AM
Prathvi
Prathvi - avatar
0
Please share your code.
12th Mar 2020, 9:09 AM
Prathvi
Prathvi - avatar
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner read=new Scanner(System.in); try(read) { String inp=read.nextLine().trim(); String oup=""; int ascii=0; for(int i=0;i<inp.length();i++) { char data=inp.charAt(i); ascii=(int)data; int ASCIIValue = ascii;   if (ASCIIValue >= 65 && ASCIIValue <= 90)         {           ASCIIValue = 65 - ASCIIValue + 122;          } else if (ASCIIValue >= 97 && ASCIIValue <= 122)   {     ASCIIValue = 97 - ASCIIValue + 90;    } else if (ASCIIValue >= 48 && ASCIIValue <= 57)   {    ASCIIValue = 48 - ASCIIValue + 57;     }   char c1 = (char)ASCIIValue;         oup = oup + c1; } System.out.println(oup.toLowerCase()); } } }
12th Mar 2020, 9:09 AM
Shivam Srivastava
Shivam Srivastava - avatar
0
What was the problem?
12th Mar 2020, 9:19 AM
Shivam Srivastava
Shivam Srivastava - avatar
0
Okay, thanks
12th Mar 2020, 9:21 AM
Shivam Srivastava
Shivam Srivastava - avatar