Multiple Class With Constructor


    import java.util.Scanner; 
    class Extra 
    { 
      public Extra() 
      { 
        System.out.println("U r at constructor "); 
      } 
      
      public void Test() 
      { 
        Scanner d = new Scanner(System.in); 
    
        System.out.println("Enter the marks of English: "); 
        int e = d.nextInt(); 
    
        System.out.println("Enter the marks of Physics: "); 
        int p = d.nextInt(); 
    
        System.out.println("Enter the marks of Chemistry: "); 
        int c = d.nextInt();
    
        System.out.println("Enter the marks of Mathematics: "); 
        int m = d.nextInt();
    
        System.out.println("Enter the marks of Biology: "); 
        int b = d.nextInt(); 
    
        System.out.println("Enter the marks of Arabic: "); 
        int a = d.nextInt(); 
    
        int t = e + p + c + m + b + a; 
    
        System.out.println("Total =" + t); 
        double per = t / 6.0; 
    
        System.out.println("Percentage is " + per); 
      } 
    } 
    
    class Constructor 
    { 
      public static void main(String ar[]) 
      { 
        Extra mm = new Extra(); 
        mm.Test(); 
      }
    }
  

Output: