plz i try to make factorial program but i have mistake

import java .util.Scanner;
public class Factorialrec {
     int fact(int n) {
          int result;
     if ( n ==1) return 1;
     result = fact (n-1) * n;
     return result;
     }
}
public static void main(String [] args){
Scanner input = new Scanner(System.in);
int z;
Factorialrec c=new Factorialrec();
System.out.println("Enter number");
z=input.nextInt();
System.out.println("is  factorial "+c.fact(z));
}

what mistake? is it a programming error? do you get an error message?
or is it a logical error, and you get a different output then expected?

this error
Factorialrec.java:11: class, interface, or enum expected
public static void main(String [] args){

-
Factorialrec.java:13: class, interface, or enum expected
int z;


give me enum expected at diferrent places

you have on closing bracket } too much right before your main method. remove it and place one right after your main method andit should compile.

oh ..
thank you . its working know
thank yoy very much
---
my problem is solved know ..

This question has already been answered. Start a new discussion instead.