why my code showing error in sololearn but its working in Intellij idea correctly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

why my code showing error in sololearn but its working in Intellij idea correctly

import java.util.Scanner public class Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); String all = "0abcdefghijklmnopqrstuvwxyz"; String name; System.out.println("Enter your name without Space :-"); name = input.next(); name = name.toLowerCase(); System.out.println(name); char [] ch = name.toCharArray(); int sum=0; for(char x: ch) sum = sum + all.indexOf(x); System.out.println("Your Lucky Number Is : "+sum); } }

26th Dec 2018, 4:51 PM
Sonu Kumar
Sonu Kumar - avatar
2 Answers
+ 8
Missing semicolon on the very first line of your code where you are importing.
26th Dec 2018, 8:00 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
Hmm, if you paste this into a Java code, it tells you exactly what it's expecting.
26th Dec 2018, 4:59 PM
Kirk Schafer
Kirk Schafer - avatar