hello. i have done the followinh program to convert a String value to a double value.when i am compiling this program, i get an error as"unclosed character literal in the 18th line.can anyone say what's the problem?
import java.io.*;
class strin
{
public static String a(String s);
{
String j="";
char a;
int i;
for(i=0;i<s.length();i++)
{
c=s.charAt(i);
if(c==' ')
{
j=j+c;
}
switch(j)
{
case 'one':System.out.print("1");break;
case 'two':System.out.print("2");break;
case 'three':System.out.print("3");break;
case 'four':System.out.print("4");break;
case 'five':System.out.print("5");break;
case 'six':System.out.print("6");break;
case 'seven':System.out.print("7");break;
case 'eight':System.out.print("8");break;
case 'nine':System.out.print("9");break;
case 'ten':System.out.print("10");break;
case 'eleven':System.out.print("11");break;
case 'twelve':System.out.print("12");break;
case 'thirteen':System.out.print("13");break;
case 'fourteen':System.out.print("14");break;
case 'fifteen':System.out.print("15");break;
case 'sixteen':System.out.print("16");break;
case 'seventeen':System.out.print("17");break;
case 'eigtheen':System.out.print("18");break;
case 'ninteen':System.out.print("19");break;
case 'twenty':System.out.print("2");break;
case 'thirty':System.out.print("3");break;
case 'fourty':System.out.print("4");break;
case 'fifty':System.out.print("5");break;
case 'sixty':System.out.print("6");break;
case 'seventy':System.out.print("7");break;
case 'eigthy':System.out.print("8");break;
case 'ninty':System.out.print("9");break;
case 'hundred':System.out.print("1");break;
case 'and':System.out.print("");break;
case 'dot':System.out.print(".");break;
case 'point':System.out.print(".");break;
}
}
return i;
}
public static void main()throws IOException
{
try
{
String r;
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter a sentence to print it in numbers");
r=x.readLnie();
String h;
str cl=new cl();
h=cl.a(r);
}
catch(Exception e)
{
System.out.print(e);
}
}
}