On Thu, May 27, 2010 at 9:07 PM, Luke Vandervort <[email protected]> wrote:
> Hi guys, hope you don't mind me asking a question! Can anyone tell me why
> variable mult is not returning to the main method? Everything else works
> great! Excuse my ignorance I am just learning this! Thanks!
>
> public class Numbers
>     {
>     public static void main(String[] args)
>     {
>                int a = 20;
>              int b = 67;
> mysum(a, b);
> mydifference(a, b);
>                 prduct(a, b);

You didn't capture the return value. Change the line above to this:

int mult = prduct(a, b);

>                 System.out.println("The product of a * b = " + mult);
>     }
>     public static void mysum(int x, int y)
>            {
>                 int newsum;
> newsum = (x + y);
>                 System.out.println("The sum of a and b = " + newsum);
>            }
>     public static void mydifference(int x, int y)
>     {
>                 int newdifference;
> newdifference = (x - y);
>                 System.out.println("The difference between a and b = " +
> newdifference);
>     }
>     public static int prduct(int x, int y)
>      {
>                 int mult;
>                 mult = (x * y);
>                 return mult;
>     }
>     }

-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to