public class PrintFactorial {
int fact = 1;
void fact(int n) {
for (int i = 1; i <= n; i++) {
fact = fact * i;
}
System.out.println(fact);
}
public static void main(String args[]) {
//calling method with anonymous object
new PrintFactorial().fact(6);
}
}