See the code below,
import java.io.*;
class Test1
{
public static void main (String arge[]) throws IOException
{
InputStreamReader values = new InputStreamReader (System.in);
BufferedReader br = new BufferedReader (values);
String value,store;
char ch;
System.out.print ("Input String: ");
value = br.readLine();
store = '';
int ln = value.length();
for (int i=0; i<ln; i++)
{
ch=value.CharAt(i);
Switch (ch)
{
case ' ':
break;
default:
store+=ch;
}
}
}
}
I want my program to remove all spaces in the string and store the new string in the variable
store
but my program giving error when i am running it.
Test1.java:12: empty character literal
store = '';
^
Test1.java:12: unclosed character literal
store = '';
^
Test1.java:12: ';' expected
store = '';
^
Test1.java:17: ';' expected
Switch (ch)
^
Test1.java:19: orphaned case
case ' ':
^
5 errors