samedi 1 novembre 2014

What is the difference between these two instance methods?


Vote count:

0




public class Food {



public int apples;
public int oranges;
public int bananas;

// Constructor #1
public Food(int a, int o, int b)
{
apples = a;
oranges = o;
bananas = b;
}


// Is this an instance


public Food myFood = new Food(5, 8, 1);


// Or this


Food.myfood(5, 8, 1)


My more experienced friend said that the latter was the instance, not the first one.



asked 37 secs ago







What is the difference between these two instance methods?

Aucun commentaire:

Enregistrer un commentaire