Results 1 to 5 of 5
  1. #1
    henal is offline Member
    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0

    Default Intresting Program

    Check out this program! It s giving an error!
    __________________________________________________ __________________________________
    import java.util.*;
    class calculate
    {
    static float mult(float a,float b)
    {
    return (a * b);
    }
    static float divide(float c, float d)
    {
    return (c / d);
    }
    }

    class pa
    {
    public static void main(String args[])
    {
    float x1 = calculate.mult(2.0,4.0);
    float x2 = y.divide(2.0,4.0);
    System.out.println(x1);
    System.out.println(x2);
    }
    }__________________________________________________ ___________________________

    Please help!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,304
    Blog Entries
    7
    Rep Power
    20

    Default Re: Intresting Program

    What is 'y'?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Uninteresting Program

    BB Code List - Java Programming Forum
    Use a meaningful subject line. Nothing interesting about the program either.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    henal is offline Member
    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0

    Default Re: Intresting Program

    Sorry my mistake!
    Its not -> float x2 = y.divide(2.0,4.0);
    Its -> float x2 = calculate.divide(2.0,4.0);

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,304
    Blog Entries
    7
    Rep Power
    20

    Default Re: Intresting Program

    Quote Originally Posted by henal View Post
    Sorry my mistake!
    Its not -> float x2 = y.divide(2.0,4.0);
    Its -> float x2 = calculate.divide(2.0,4.0);
    Ok, and what is the error? You do have to supply details if you want us to be able to help you.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2011, 12:57 PM
  2. Replies: 13
    Last Post: 03-22-2011, 06:49 AM
  3. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •