获取返回两个整数的函数 [英] Getting a function to return two integers

查看:149
本文介绍了获取返回两个整数的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个函数,我希望它返回两个整数作为结果。但是,我无法做到这一点。有人能帮助我吗?这里是我最好的拍摄场景

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");                    
    }


推荐答案

int

public static int[] calc (int s, int b, int c, int d, int g)

这篇关于获取返回两个整数的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆