jeudi 13 mai 2021

I cant access a class I defined from the main loop? [SOLVED]

I have an extremely simple piece of code where I am calling a method that I defined, and it wont run because it says I haven't defined the method?

class Main {
  public static void main(String[] args) {
go(7,3);
  }

} /// in a separate file named go.java -->

 class go{
public static int go(int x, int y){
 if(x <= 1)
     return y;
  else
      return go(x - 1, y) + y;

} }

Aucun commentaire:

Enregistrer un commentaire