Compliation Error :(

strong textHello.
So the following the code which works absolutely fine in netbeans but when I upload on CODECHEF, it shows COMPILATION ERROR. Plz help. I want to know where am I wrong while copying the code so that I can amend it and go for further codes.

import java.util.Scanner;
public class Main {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int l,b;
System.out.println("Enter length and breadth: ");
l=in.nextInt();
b=in.nextInt();
float area, peri;
area = l*b;
peri = 2*(l+b);
if(area>peri){
    System.out.println("Area");
    System.out.println("Area="+area);
}
else
    System.out.println("Perimeter");
System.out.println("Perimeter"+peri);

}
}

I think there is an error in

public class Main()

If it is public, then the class name has to be codechef else don’t make it public.

Secondly, never use extra output statements, such as "Enter length and breadth: " as it will give WA on submitting.

Make sure that the output matches exactly with the sample output.

Please upvote and accept the answer, if it solved your doubt!

thank you. It was really helpful. I really appreciate your help.

Sorry to trouble again, but this time I *uploaded with Scanner in = new Scanner(); and it showed wrong. without scanner also it shows compilation error.
:frowning:
what should i write/change?

class Main {

public static void main(String[] args) {

int l,b;

float area, peri;
area = lb;
peri = 2
(l+b);
if(area>peri){
System.out.println(“area”);
System.out.println(area);
}
else
System.out.println(“Peri”);
System.out.println(+peri);
} }

https://www.codechef.com/viewsolution/19057232

Check this out! I hope it will solve all your doubts!
Scanner in = new Scanner(System.in)
is required!

Also note that area and perimeter would be integers and not float given that L, B are integers.

I also changed the data type of L, B to long, just as a precaution, as for large inputs of L, B, they might overflow! (Not necessary)!