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(); } }
2 Respuestas
+ 4
You cannot define package names in SL. Please take a note of it.
+ 2
last println
system.out.println(s[k])
it's k not i as k is iterating till i