title: how to pass class object as variable as constructor parameter in another class?
body: <p>I have one class called Fullname having variables fname,mname and lname.
  Then another class Participant having variable name of type Fullname, marks of type int.
  In another class I have to create array of Participant of size 5 and have to store information from  user input.</p>
  <p>My problem is how to read value for Fullname variable and then pass it as constructor parameter.
  while using scanner it is giving error that cannot convert from string to Fullname.</p>
  <p>I am not getting correct output for Fullname variable</p>
  <pre><code>public class Participant {
      fullname name;
      int rollno;
      float marks;
  
      public Participant(fullname nameFullname, int rollno, float marks) {
          super();
          this.name=new fullname(null, null, null);
          this.rollno = rollno;
          this.marks = marks;
      }
  
      @Override
      public String toString() {
          return &quot;name=&quot; + name + &quot;, rollno=&quot; + rollno + &quot;, marks=&quot; + marks + &quot;&quot;;
      }
  }
  
  public class Implements {
  
      public static void main(String[] args) {
          String a = null, b = null, c = null;
          int rollno = 0;
          float marks = 0;
          Participant part[] = new Participants[5];
          Scanner sc = new Scanner(System.in);
  
          rollno = sc.nextInt();
          marks = sc.nextFloat();
          a = sc.next();
          b = sc.next();
          c = sc.next();
  
          Fullname name = new Fullname(a, b, c);
  
          part[1] = new Participant(name, rollno, marks);
          System.out.println(part[1].toString());
      }
  }
  </code></pre>