title: Logic in constructor?
body: <p>The code below is working fine but I'm wondering if there are any issues coming in object creation time.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class FactorialExample {
      public FactorialExample(int n) {
          int fact=1;
          for(int i=1;i&lt;=n;i++) {
                fact=fact*i;  
          }
          System.out.println("the factorial of a given number is::"+fact);        
      }
              public static void main(String[] args) {
          Scanner sc=new Scanner(System.in);
          System.out.println("Enter any Integer Value:");
          int value=sc.nextInt();
          FactorialExample fe=new FactorialExample(value);
  
      }
  }
  </code></pre>