Q:

Why is it showing ";" expected in main statement while compiling?

Not able to compile and it is showing ; expected at the end of public static statement.
//Recursive program

class Recur
{
    public static void main(String args[])
    void witty(String n, int p)
   {

       if(p<0)
       System.out.println("");
       else
       { 
           System.out.println(n.charAt(p)+".");
           witty(n, p-1);
           System.out.print(n.charAt(p));
        }
    }
}

A:

It seems that you forgot the body of the main method:
public static void main(String args[]) {
}

Note that the body of a method is delimited by { and }.

