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();
    }
}

that's because you've named your own class String, which is a very bad idea.

class String
    String str;
    String newstr;

first of all, you're missing a { there, which means that this is not the actual code you are trying.

try this:

class String{
    java.lang.String str;
    java.lang.String newstr;

otherwise the compiler will assume you meant to use your own String class.
anyway, better sollution: give your class another name

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.