DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: errors, help

  1. #1
    Lindsey Guest

    errors, help


    This is the part of the program that is giving me problems, and I don't know
    why. I get the same error for each line, which is basically the same. Everything
    is declared, and as far as I know, i'm useing the right syntax.


    /**Test to display numerators and denominators*/
    int testNum1 = r1.numerator();
    int testNum2 = r2.numerator();
    int testNum3 = r3.numerator();
    int testNum4 = r4.numerator();
    int testNum5 = r5.numerator();
    int testNum6 = r6.numerator();

    int testDen1 = r1.denominator(); // Ok, this is the same thing as
    the numerator code above, but this code does not give me any errors.
    int testDen2 = r2.denominator();
    int testDen3 = r3.denominator();
    int testDen4 = r4.denominator();
    this goes on…..

    //These are the errors that I ‘m getting. Please help.

    TestRational.java:16: numerator(Rational) in Rational cannot be applied to
    ()
    int testNum1 = r1.numerator();
    ^
    TestRational.java:17: numerator(Rational) in Rational cannot be applied to
    ()
    int testNum2 = r2.numerator();
    ^
    TestRational.java:18: numerator(Rational) in Rational cannot be applied to
    ()
    int testNum3 = r3.numerator();
    ^
    TestRational.java:19: numerator(Rational) in Rational cannot be applied to
    ()
    int testNum4 = r4.numerator();
    ^
    TestRational.java:20: numerator(Rational) in Rational cannot be applied to
    ()
    int testNum5 = r5.numerator();
    ^
    TestRational.java:21: numerator(Rational) in Rational cannot be applied to
    ()
    int testNum6 = r6.numerator();
    ^


  2. #2
    Paul Clapham Guest

    Re: errors, help

    That means that r1 and the rest are objects of class Rational, which you may
    have written yourself or got from somewhere else. It has a method called
    numerator that takes a single Rational parameter, but it does not have a
    method called numerator with no parameters. That's what those messages are
    saying. But it **does** have a method called denominator with no
    parameters.

    If Rational is what I think it is, then its numerator method is mis-declared
    and should not have any parameters.

    PC2

    "Lindsey" <zave4@aol.com> wrote in message news:3acf96ea$1@news.devx.com...
    >
    > This is the part of the program that is giving me problems, and I don't

    know
    > why. I get the same error for each line, which is basically the same.

    Everything
    > is declared, and as far as I know, i'm useing the right syntax.
    >
    >
    > /**Test to display numerators and denominators*/
    > int testNum1 = r1.numerator();
    > int testNum2 = r2.numerator();
    > int testNum3 = r3.numerator();
    > int testNum4 = r4.numerator();
    > int testNum5 = r5.numerator();
    > int testNum6 = r6.numerator();
    >
    > int testDen1 = r1.denominator(); // Ok, this is the same thing as
    > the numerator code above, but this code does not give me any errors.
    > int testDen2 = r2.denominator();
    > int testDen3 = r3.denominator();
    > int testDen4 = r4.denominator();
    > this goes on...
    >
    > file://These are the errors that I 'm getting. Please help.
    >
    > TestRational.java:16: numerator(Rational) in Rational cannot be applied to
    > ()
    > int testNum1 = r1.numerator();
    > ^
    > TestRational.java:17: numerator(Rational) in Rational cannot be applied to
    > ()
    > int testNum2 = r2.numerator();
    > ^
    > TestRational.java:18: numerator(Rational) in Rational cannot be applied to
    > ()
    > int testNum3 = r3.numerator();
    > ^
    > TestRational.java:19: numerator(Rational) in Rational cannot be applied to
    > ()
    > int testNum4 = r4.numerator();
    > ^
    > TestRational.java:20: numerator(Rational) in Rational cannot be applied to
    > ()
    > int testNum5 = r5.numerator();
    > ^
    > TestRational.java:21: numerator(Rational) in Rational cannot be applied to
    > ()
    > int testNum6 = r6.numerator();
    > ^
    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links