Hypotenuse and name generator I am a self-taught programmer and I just started learning Java and wrote a simple program. If anyone more experienced than myself can go over my code and give me some pointers I would really appreciate it.

The program starts by asking the user to enter either 0 for the name generator or 1 for the hypotenuse generator (uses the Pythagorean Theorem). Then it asks for follow up questions based on the starting choice. (I'm using Terminal to run this program.)

Simple.java

import java.util.Scanner;
public class Simple {
    static int a = 13;
    static int b = 27;
    public static void main(String args[]) {
        Scanner reader1 = new Scanner(System.in);
        System.out.println("Name Gen = 0, Hypotenuse Calc = 1");
        int choice = reader1.nextInt();

        if (choice == 1) {
            System.out.println("enter num for a");
            a = reader1.nextInt();
            System.out.println("enter num for b");
            b = reader1.nextInt();
            SimpleTwo.firstMethod(a, b);
            reader1.close();
            String[] arg = new String[0];
        }else{
            SimpleTwo obj = new SimpleTwo();
            System.out.println("age?");
            int n = reader1.nextInt();
            obj.age = n;
            System.out.println("first name?");
            String fname = reader1.next();
            obj.fName = fname;
            System.out.println("last name?");
            String lname = reader1.next();
            obj.lName = lname;
            reader1.close();
            SimpleTwo.myMethod();
        }

    }
}


SimpleTwo.java

public class SimpleTwo {
    static int age = 0;
    static String fName = "";
    static String lName = "";

    public static void myMethod() {
        System.out.println(age+", "+fName+", " + lName);
    }

    public static void firstMethod(int a, int b) {
        int ab = (a * a) + (b * b);
        double c = Math.sqrt(ab);
        System.out.println("The length of the Hypotenuse is " + c + ", when a=" + a + " &amp; b=" + b + ".");
    }
}
SimpleTwo obj = new SimpleTwo();


is unnecessary because all your properties and methods of SimpleTwo are static, therefore creating an instance of SimpleTwo does nothing unless you have something in it that's not static. I would also guess that lines with code like obj.age give you a compiler warning because you should be using SimpleTwo.age since age is a static member.

I would also change the names of the classes and the methods to something more meaningful. firstMethod doesn't describe what it is for and technically it is the second method in your class