title: passing an object(s) to be serialised java
body: <p>I have scoured many web pages trying to solve this issue, but I am struggling. I don't want someone to fix it for me, I just want someone to point me in the right direction please :).<br><br> My problem is two-fold, I have an array of objects,I want to pass each object to my Teams class, so that the team name can be saved. This code doesn't compile, error concerns line:<br> "Teams(MainmenuTest[]) teamName() {"</p>
  
  <p>error is '.class' expected
  followed by
  ';' expected</p>
  
  <p>I can get serialisation to work when the objects are created in my Teams class, (if I comment out the code for passing objects), and it does create a .ser file in the directory I have specified. </p>
  
  <p>Here are the snippets of code:</p>
  
  <pre><code>public class Teams implements java.io.Serializable{
  
    public Teams(){
  
      // constructor
      MainmenuTest[] teamName;
      Teams(MainmenuTest[]) teamName() {
        this.teamName = teamName;
      }
    }
  
  
  
     public String name;
     public String address;
     public transient int SSN;
     public int number;
     public void mailCheck()
     {
        System.out.println("Mailing a check to " + name + " " + address);
     }
  } // end Teams class
  
  
  
  public class premierLeagueClubs{
  
    public String club;
    Teams[] teamName = new Teams[19];
    premierLeagueClubs f = new premierLeagueClubs();
    Teams t = new Teams(f,teamName);
  
  
  public String arsenal(){
  
    teamName[0].club = "Arsenal";
  
  System.out.println("You are the new manager of" + club);
  return club;
  } // end method arsenal
  </code></pre>
  
  <p>Here is the MainmenuTest code:</p>
  
  <pre><code>import java.util.InputMismatchException;
  import java.util.Scanner;
  import java.io.*;
  import java.util.Arrays;
  
  public class MainmenuTest extends premierLeagueClubs{
  
  
  
  int choice;
  
  public MainmenuTest(){
  
  //constructor
  }
  
  
  public static void main(String args[]){
  
      MainmenuTest team = new MainmenuTest();
  
  team.getInput();
  
  
  
    } // end main method
  </code></pre>