Error : java.lang.String cannot be converted to String
import java.util.*;
class String
String str;
String newstr;
void inputString()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string:");
str = sc.nextLine();
}
void checkFrequency()
{
int freq = 0;
System.out.println("CHARCTER FREQUENCY");
if(str.isUpperCase)
{
char []sArray = new String[str.length - 1];
for(int i = 0; i<= str.length() - 1; i++)
{
sArray[i] = str.charAt[i];
}
char temp;
for(int i = 0; i <= Array.length - 2; i++)
{
for(int i = 0; i <= sArray.length - 2; i++)
if(sArray[j] > sArray[j + 1]);
{
temp = sArray[j];
sArray[j] = sArray[j + 1];
sArray[j + 1] = temp;
}
}
for(int i = 0; i<= sArray.length - 1; i++)
{
if(exists(sArray[i]))
freq++;
else
{
newstr = newstr + sArray[i];
freq++;
}
System.out.println(sArray[i] + freq);
freq = 0;
}
}
}
boolean exists(char a)
{
for(int i = 0; i <= newstr.length() - 1; i++)
{
if(newstr.charAt(i) == a)
return true;
}
return false;
}
static void main()
{
String obj = new String();
obj.inputString();
obj.checkFrequency();
}
}