一切正常,但没有运行? [英] every things are ok but it doesnt run?

查看:80
本文介绍了一切正常,但没有运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="cs">package bmm2;
import GCD.GCD;
public class Main{
   public static void main(String[] args) {
      long x = Long.parseLong(args[0]);
      long y = Long.parseLong(args[1]);
      long z = GCD.gcd1(x, y);
      System.out.println("Method 1: gcd(" + x + ", " + y + ") = " + z);
           z = GCD.gcd2(x, y);
      System.out.println("Method 2: gcd(" + x + ", " + y + ") = " + z);
   }
}





<pre lang="cs">package GCD;
public class GCD {
   public static long gcd1(long x, long y) {
      if (y == 0) return x;
      return gcd1(y, x % y);
   }
   public static long gcd2(long x, long y) {
      while (y != 0) {
         long r = x % y;
         x = y; y = r;
      }
      return x;
   }
}




在long x = Long.parseLong(args [0]); ?????????




it have an error on long x = Long.parseLong(args[0]);????????

推荐答案

上,当您运行程序时需要错误传递两个参数.我假设代码没有错误.

------------

答案2

像这样
when you run the program you need to pass two args. I am assuming the code has no errors.

------------

Answer 2

like this
Java Main 1 2


这篇关于一切正常,但没有运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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