Код: Выделить всё
public class Journey
{
private int journeyID; // the id of the journey
private String transportMode; // the public transport mode of the journey (can be only “train”, “bus” or “tram”)
private int startOfJourney; // the starting point of the journey. It can be only a number between [1..10]
private int endOfJourney; // the ending point of the journey. It can be only a number between [1..10] (should be different from the starting point of the journey)
private int distanceOfJourney;
Код: Выделить всё
public class SmartCard
{
private int cardID; // the id of the smartcard
private char type; // the type of the smartcard (it can be "C", "A" or "S")
private float balance; // the balance available on the smartcard (should have a minimum balance of $5)
private Journey journey1 = null; // journey object
private Journey journey2 = null; // journey object - can only be used if the type of the smartcard is "A" or "S"
private Journey journey3 = null;
Я пытаюсь получить доступ к объекту Journey с помощью
Код: Выделить всё
smartCard1.journey1 == null;
Код: Выделить всё
smartCard1.journey1.getJourneyID()==0;
Подробнее здесь: https://stackoverflow.com/questions/784 ... r-classess