what is the use of final while declaring the string variable? : my compiler was showing error while declaring the string variable but the hints showed that final is missing. after correcting, it worked but what is the use of final?


class outerclass
{
    private static string upa = "tobby";
    
    static class a
    {
        void printmessage(){
            System.out.println("who is a good boy?"+upa);
            
        }
        
    }
    class b
    {
        void printagain()
        {
            System.out.println("who is a bad boy?"+upa);

        }
                
    }
}

public class Main {

    public static void main(String[] args) {
        outerclass.a oa=new outerclass.a();
        oa.printmessage();
        
        outerclass outer= new outerclass();
        outerclass.b ob= outer.new b();
        
        ob.printagain();
        
        
        
    }
    
}
