How to solve error lossy convertion from int to char?

Viewed 27167

I am begginer.While compiling this code

class UpperLowerCase

{   
    static String ini = "I LOVE JAVA";
    static char str[] = ini.toCharArray();
    static char invr[] = new char[10];
    static int len = 0 , len1 = 0, i;

    static void toUpper()
    {
        for(i=0;i<str.length;i++)
        {
            if(str[i]>=97 && str[i]<=122)
                invr[len1++]=(str[i]-32);
            else
                invr[len++]=str[i];
        }
        invr[len1]='\0';
        System.out.println("Reverse of"+ str+" is \n"+ invr);

    }

    static void toLower()
    {
        for(i=0;i<str.length;i++)
        {
            if(str[i]>=65 && str[i]<=90)
                invr[len1++]=str[i]-32;
            else
                invr[len++]=str[i];
        }
        invr[len1]='\0';
        System.out.println("Reverse of"+ str+" is \n"+ invr);
    }

public static void main(String [] args)
{
    toUpper();
}

}

I get error "possible lossy conversion from int to char"

How to convert int to char.

Please help me by telling how to resolve this error?

1 Answers
Related