calling from another classwhy isn't oneSite not applied to int

Discussion in 'Java' started by Jucy Love, Jul 21, 2003.

  1. Jucy Love

    Jucy Love Guest

    this is the first file called EventSite3.java
    public class EventSite3
    {
    private int siteNumber;
    public int getSiteNumber()
    {
    return siteNumber;
    }
    public void setSiteNumber(int n)
    {
    siteNumber = n;
    }
    }

    this is the second file called SetUpSite5.java
    public class SetUpSite5
    {
    int currentYear = 2003;
    int age;
    EventSite3 oneSite = new EventSite3();
    int number;


    public void statementOfPhilosophy()
    {
    age = calculateAge(currentYear);
    number = oneSite.getSiteNumber();
    oneSite.getSiteNumber(9);
    System.out.println("Serving you " + age + " years");
    System.out.println("The number of the event site is " + number);
    System.out.println("Event Handlers Incorporated is");
    System.out.println("dedicated to making your event");
    System.out.println("a most memorable one.");
    }
    public static int calculateAge(int currDate)
    {
    int yrs;
    yrs = currDate - 1977;
    return yrs;
    }
    }
    Jucy Love, Jul 21, 2003
    #1
    1. Advertising

  2. On 20 Jul 2003 16:10:55 -0700, (Jucy Love) wrote:
    > number = oneSite.getSiteNumber();
    > oneSite.getSiteNumber(9);


    Guess I don't understand this. Here you are getting the
    site number before it has ever been set, then you are
    making an invalid call, getSiteNumber() does not take an
    int as a parameter, it only returns an int as in the
    previous call. The above code will not even compile
    as written.

    --Joe
    Joseph Millar, Jul 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schnoffos
    Replies:
    2
    Views:
    1,208
    Martien Verbruggen
    Jun 27, 2003
  2. Hal Styli
    Replies:
    14
    Views:
    1,629
    Old Wolf
    Jan 20, 2004
  3. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    Theme isn't being applied to content page

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Aug 21, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    357
    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=
    Aug 21, 2006
  4. aling
    Replies:
    8
    Views:
    945
    Jim Langston
    Oct 20, 2005
  5. powerhouse04
    Replies:
    1
    Views:
    321
    powerhouse04
    Dec 16, 2007
Loading...

Share This Page