Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a function to return two integers

I am writing a function and I want it two return two integers as results. However, I cannot get it to do this. Could someone help me? Here is my best shot

public static int calc (int s, int b, int c, int d, int g)
    {
        if (s==g)
            return s;
        else if (s+b==g)
                return s && b;

        else if (s + c==g)
                return s && c;

         else if (s+d==g)
                return s && d;

        else
            System.out.println("No Answer");                    
    }
like image 714
Spencer Avatar asked Sep 06 '10 01:09

Spencer


1 Answers

You could have the method return an array of int:

public static int[] calc (int s, int b, int c, int d, int g)
like image 170
akf Avatar answered Nov 13 '22 00:11

akf