title: How to initialize Object of a class with primitive types
body: <p>I have seen various threads and most of them talk about default values like primitive are initialized with <strong>0</strong> and Wrappers are initialized with <strong>null</strong>.
  My question is specific and with example rather than just concept.</p>
  
  <p>My class:</p>
  
  <pre><code>public class Subject {
      int subCode;
      int marks;
      long CGPA;
  
      public Subject(int subCode, int marks, long CGPA) {
          this.subCode = subCode;
          this.marks = marks;
          this.CGPA = CGPA;
      }
  
  }
  </code></pre>
  
  <p>Now here goes my Map in Main class:</p>
  
  <pre><code>Map&lt;Integer,List&lt;Subject&gt;&gt; map1 = new HashMap&lt;&gt;();
          map1.put(Integer.valueOf(1),new Subject(001,70,29l));
  </code></pre>
  
  <p>I am getting error in <code>29l</code>, i tried various forms like <code>Long.Valueof(29)</code>, but they dont work.</p>
  
  <p>Can anyone tell me the concept of when there is primitive types in filed of a class then how to make instance of class using constructor.</p>
  
  <blockquote>
    <p><strong>Note:</strong> I am fully aware that i should use Wrapper class here, but now i wanna try with primitive, it is just for my learning.</p>
  </blockquote>
  
  <p>Thank you.</p>