Area Calculator in Java This is a simple Area Calculator coded in Java. What this does is that it prompts the user to select a shape, and asks for the details needed to calculate the area of that specific shape.

Main.java:

package com.AreaCalculator;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("Welcome to the Area Calculator! Enter 1 to find the area of a Rectangle, Enter 2 to find the area of a Square, Enter 3 to find the area of a Triangle or Enter 4 to find the area of a Circle");

        int userInput = Integer.parseInt(scanner.next());

        if(userInput == 1) {
            System.out.println("Please enter the length of the rectangle: ");
            int length = Integer.parseInt(scanner.next());
            System.out.println("Please enter the width of the rectangle: ");
            int width = Integer.parseInt(scanner.next());

            System.out.println(length * width);
        } else if(userInput == 2) {
            System.out.println("Please enter the length of a side: ");
            int lengthOfASide = Integer.parseInt(scanner.next());

            System.out.println(lengthOfASide * lengthOfASide);
        } else if(userInput == 3) {
            System.out.println("Please enter the base of the triangle: ");
            int triangleBase = Integer.parseInt(scanner.next());
            System.out.println("Please enter the height of the triangle: ");
            int triangleHeight = Integer.parseInt(scanner.next());

            System.out.println((0.5 * triangleBase) * triangleHeight);
        } else if(userInput == 4) {
            System.out.println("Please enter the radius of the circle: ");
            int radius = Integer.parseInt(scanner.next());

            System.out.println(Math.PI * (radius * radius));
        }
    }
}
Making a package for a one-class program seems like overkill.  You would be better off naming the class AreaCalculator, which would be more meaningful than Main.

Instead of writing the menu as a very long string, it would be more manageable to split it:

System.out.println("Welcome to the Area Calculator! " +
    "Enter 1 to find the area of a Rectangle, " +
    "Enter 2 to find the area of a Square, " +
    "Enter 3 to find the area of a Triangle or " +
    "Enter 4 to find the area of a Circle");


(This has no effect on performance.  The compiler will embed just one long string constant in the bytecode.)

A chain of if-elses would be better written using a switch block.  Not only is it easier to see the patten at a glance, it is also more efficient, in that it compiles to a single tableswitch opcode.

Since there are so many places where you write System.out.println() followed by scanner.nextInt(), it makes sense to write a function for that.  Should you later decide to add validation and error handling, you can implement it in one central place.  I suggest changing System.out.println() to System.out.print().

I don't see any reason why the inputs should be restricted to ints.  You could just as easily accept doubles.

I recommend splitting each calculation into a separate function, to ensure that they do not interfere with each other.  For example, if you were to add support for parallelograms and trapezoids, you might have a conflict for a variable named height, if you lumped everything into main().  The resulting main() would be just a menu.

import java.util.Scanner;

public class AreaCalculator {
    private static double ask(Scanner scanner, String prompt) {
        System.out.print(prompt);
        return scanner.nextDouble();
    }

    private static void rectangle(Scanner scanner) {
        double length = ask(scanner, "Please enter the length of the rectangle: ");
        double width = ask(scanner, "Please enter the width of the rectangle: ");
        System.out.println(length * width);
    }

    private static void square(Scanner scanner) {
        double lengthOfASide = ask(scanner, "Please enter the length of a side: ");
        System.out.println(lengthOfASide * lengthOfASide);
    }

    private static void triangle(Scanner scanner) {
        double triangleBase = ask(scanner, "Please enter the base of the triangle: ");
        double triangleHeight = ask(scanner, "Please enter the height of the triangle: ");
        System.out.println(0.5 * triangleBase * triangleHeight);
    }

    private static void circle(Scanner scanner) {
        double radius = ask(scanner, "Please enter the radius of the circle: ");
        System.out.println(Math.PI * (radius * radius));
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("Welcome to the Area Calculator! " +
            "Enter 1 to find the area of a Rectangle, " +
            "Enter 2 to find the area of a Square, " +
            "Enter 3 to find the area of a Triangle or " +
            "Enter 4 to find the area of a Circle");

        switch (scanner.nextInt()) {
          case 1:
            rectangle(scanner);
            break;
          case 2:
            square(scanner);
            break;
          case 3:
            triangle(scanner);
            break;
          case 4:
            circle(scanner);
            break;
        }
    }
}