0

Why it is not returning anything?

package sololearn; import java.util.Scanner; public class RemoveChars { public static void main(String[] args) { Scanner cin = new Scanner(System.in); String s1 = cin.nextLine(); int n = s1.length(); int j; int k ; int i = 0; char[] s = new char[n]; for (j = 0; j < n; j++) { if(s1.charAt(j)=='@') continue; s[i]=s1.charAt(j); i++; } for (k = 0; k < i; k++) System.out.println(s[i]); cin.close(); } }

10th May 2018, 11:12 AM
Ilie Razvan
Ilie Razvan - avatar
2 Respostas
+ 4
You cannot define package names in SL. Please take a note of it.
10th May 2018, 12:12 PM
Dev
Dev - avatar
+ 2
last println system.out.println(s[k]) it's k not i as k is iterating till i
10th May 2018, 11:31 AM
‎ ‏‏‎Anonymous Guy