Am I using constructors properly?

No. You should avoid doing logic or anything that can cause an exception in constructors.

You should avoid nested classes (classes inside of other classes.)

In this case, your PygLatin class would be better off as a method where it takes a string and returns a translated string.

You can't use .toLowerCase() on a char, because a char is not an object/class. It cannot have methods. A string is class with its own methods, variables, etc.

Ex something like this:

 public class application 
{
    public string PygLatin(String word) 
    {
        String stem = word.substring(1);
        String pyg = (word.charAt(0)) + "ay";
        pyg = pyg.toLowerCase();
        String product = stem + pyg;
        return product;
    }

    public static void main(String[] args) 
    {

        string x = PygLatin("Hamlet");
        string y = PygLatin("Horse");

        System.out.println(x);
        System.out.println(y);
    }
}
/r/learnprogramming Thread