Question: I want to create a program in Java, which -- basing on user inputs -- finds the area of the entered shape. But I failed to achieve that.

This is my script:

```
import java.util.Scanner;

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

    nu();
}
int length;
    int height;
int area;

public  void nu(){
    String message = advance.nextLine();

    if (message.equalsIgnoreCase("rectangle")){

        System.out.println("Enter the length of the rectangle: ");

        length  = advance.nextInt();

        //length declared.//
        System.out.println("Enter the height of the rectangle");

        height = advance.nextInt();

        //Height has been declared.//

        area = length * height;

        System.out.print("The area is: " + area);
    }
}
}

```

First problem is, that this code is not running and so I don't know if its working. All the other things are fine. Can you tell me, what I'm doing wrong?

Answer: 
You need to add `static` to the main method and create a new instance of `area`. See the code below.

```
public class area {
static Scanner advance = new Scanner(System.in);
public static void main(String[] args) {

    new area().nu();
}
int length;
int height;
int area;

public  void nu(){
    String message = advance.nextLine();

    if (message.equalsIgnoreCase("rectangle")){

        System.out.println("Enter the length of the rectangle: ");

        length  = advance.nextInt();

        //length declared.//
        System.out.println("Enter the height of the rectangle");

        height = advance.nextInt();

        //Height has been declared.//

        area = length * height;

        System.out.print("The area is: " + area);
    }
  }
}

```
Because of Java program can't find the main method to run:
We need to add static keyword in 3 places according to your code.

Please try with below full source code:

```
import java.util.Scanner;

public class area {
    static Scanner advance = new Scanner(System.in);

    public  static void main(String[] args) { //1st change

        nu();
    }
    static int length; //2nd change
    static int height; //2nd change
    static int area; //2nd change

    public static  void nu(){ //3rd change
        String message = advance.nextLine();

        if (message.equalsIgnoreCase("rectangle")){

            System.out.println("Enter the length of the rectangle: ");

            length  = advance.nextInt();

            //length declared.//
            System.out.println("Enter the height of the rectangle");

            height = advance.nextInt();

            //Height has been declared.//

            area = length * height;

            System.out.print("The area is: " + area);
        }
    }
}

```