How would I write a constructor for my class if there aren't any instance variables?
<p>I want to write a constructor that accepts no arguments, so how would I do that if i have no instance variables, am used to creating a constructor where i have instance variables, I know java creates a default constructor if i don't have one but i was told that is a bad programming practice???(new to classes)</p>

<pre><code>public class Validator {
    public Validator() {
    }

    public String getString(Scanner sc, String prompt) {
        System.out.print(prompt);
        String s = sc.next(); // read user entry
        sc.nextLine(); // discard any other data entered on the line
        return s;
    }

    public int getInt(Scanner sc, String prompt) {
        int i = 0;
        boolean isValid = false;
        while (isValid == false) {
            System.out.print(prompt);
            if (sc.hasNextInt()) {
                i = sc.nextInt();
                isValid = true;
            } else {
                System.out.println("Error! Invalid integer value. Try again.");
            }
            sc.nextLine(); // discard any other data entered on the line
        }
        return i;
    }

    public int getInt(Scanner sc, String prompt, int min, int max) {
        int i = 0;
        boolean isValid = false;
        while (isValid == false) {
            i = getInt(sc, prompt);
            if (i &lt;= min)
                System.out.println("Error! Number must be greater than " + min
                        + ".");
            else if (i &gt;= max)
                System.out.println("Error! Number must be less than " + max
                        + ".");
            else
                isValid = true;
        }
        return i;
    }

    public double getDouble(Scanner sc, String prompt) {
        double d = 0;
        boolean isValid = false;
        while (isValid == false) {
            System.out.print(prompt);
            if (sc.hasNextDouble()) {
                d = sc.nextDouble();
                isValid = true;
            } else {
                System.out.println("Error! Invalid decimal value. Try again.");
            }
            sc.nextLine(); // discard any other data entered on the line
        }
        return d;
    }

    public double getDouble(Scanner sc, String prompt, double min, double max) {
        double d = 0;
        boolean isValid = false;
        while (isValid == false) {
            d = getDouble(sc, prompt);
            if (d &lt;= min)
                System.out.println("Error! Number must be greater than " + min
                        + ".");
            else if (d &gt;= max)
                System.out.println("Error! Number must be less than " + max
                        + ".");
            else
                isValid = true;
        }
        return d;
    }
}
</code></pre>
