Wrote two functions, here is the first:

static void funcX (int xx) { x = xx; while (xx < 5) { System.out.print ("|"); } } 

And here is the second:

 static void funcY (int yy) { y = yy; int result = funcX() * yy; System.out.println (result); } 

When you start both functions in turn, an incomprehensible (for me) error occurs:

/MyClass.java:39: error: cannot find symbol x = xx;

symbol: variable x location: class MyClass /MyClass.java:49: error: cannot find symbol y = yy;

symbol: variable y location: class MyClass / MyClass.java:51: error: method funcX in class MyClass; int result = funcX () * yy;

  • 2
    where are the variables x and y declared? int result = funcX() * yy; - funcX nothing. What do you multiply by yy ? - Igor
  • one
    @Igor the same question - Antonio112009
  • static int x = chisla.nextInt (); static int y = chisla.nextInt (); - Don't Need It
  • 2
    @Not neededThis These variables are not visible inside the funcX and funcY ; transfer their declaration to the class body. - Igor
  • 3
    @Not necessaryThis add the full code to the question - Antonio112009

1 answer 1

The error is that you multiply by the return value of the funcX() method, which returns nothing. I advise you to use a good IDE that would suggest this error.

  • Intellij IDEA Community for example. - Anton Sorokin