Method cannot be applied to java.lang.Object (should accept object of specific class as argument)
<p>I'm trying to get a string from the content of an object with a custom method in my Android application. The object is an instance of the class <code>Game</code> and is contained in an <code>arraylist</code>:</p>

<pre><code>public class Game {

    private static List&lt;Game&gt; games = new ArrayList&lt;Game&gt;();
    private String teamName1;
    private String teamName2;
    private int goalsP1;
    private int goalsP2;

    private String result;


    public Game(String teamName1, String teamName2, int goalsP1, int goalsP2)
    {
        this.teamName1 = teamName1;
        this.teamName2 = teamName2;
        this.goalsP1 = goalsP1;
        this.goalsP2 = goalsP2;
    }

    public static List getGames() {
    return games;
    }

    public static void addGameToArray(Game randGame) { games.add(randGame);}

    public static String getStringFromGame(Game randGame) {
        randGame.result = randGame.result + randGame.teamName1 + randGame.goalsP1 + randGame.goalsP2 + randGame.teamName2;
        return randGame.result;
    }
</code></pre>

<p>In my <code>MainActivity</code> I'm trying to call the <code>getStringFromGame</code>: </p>

<pre><code>    Game game1 = new Game("Man City ","Real Madrid", 5 ,0);

    Game.addGameToArray(game1);

    String result = Game.getStringFromGame(Game.getGames().get(0));
</code></pre>

<p>I get an error:</p>

<blockquote>
  <p>getStringFromGame cannot be applied to java.lang.Object</p>
</blockquote>

<p>What is going wrong?</p>