多选题

What’s the output of&n...

发布于 2022-03-03 17:31:15

What’s the output of following code? (单选)

class MyCode {
  public static void main (String[] args) { 
    System.out.println(calc(30) % 3)
  }
  
  private static ArrayList<Long> arr = new ArrayList<Long>()
  static {
    arr.add(1L)
    arr.add(1L)
  }
  
  private static Long calc(int x) {
    if (arr.size() > x) {
      return arr.get(x)
    }
    Long result = calc(x - 1) + calc(x - 2)
    arr.add(result)
    return result
  }
  
}

登录后免费查看答案
关注者
0
被浏览
19
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看