title: How do I make a constructor that assigns multiple parameters?
body: <p>I am really new to java and just trying to get my head around how everything works. I have a method like this:</p>
  
  <pre><code>public assignmentmarks(String name, int mark1, int mark2, int mark3)
  {
  
  }
  </code></pre>
  
  <p>and the question asks to create the constructor that uses all the fields (courseName, assignment1, assignment2, assignment3)</p>
  
  <p><strong>This is what I have tried</strong></p>
  
  <pre><code>import java.util.Scanner;
  public class assignmentmarks {
  
       private String courseName;
       private int assignment1;
       private int assignment2;
       private int assignment3;
       int average;
       int mark;
  
       Scanner scanner = new Scanner(System.in);
  
      public void AssignmentMarks(String name, int mark1, int mark2, int mark3)
      {
          assignment1 = mark1;
          assignment2 = mark2;
          assignment3 = mark3;
          courseName = name;
  
          AssignmentMarks assignmentMarks = new AssignmentMarks(mark1, mark2, mark3, name);
      }
  
  </code></pre>