public void showOver(char x, int v){ System.out.println(x,v); } }
I have try to pass x and v to "Println" like above and I've got an error
why?
public void showOver(char x, int v){ System.out.println(x,v); } }
I have try to pass x and v to "Println" like above and I've got an error
why?
System.out.println()
only takes a single argument. You need to concatenate x and v somehow into a single String.
Multiple solutions, the easiest
System.out.println(x + ", " + v);
others might include
System.out.println(String.format("%c, %d", x, v));
You can also use System.out.printf()
, but note this does not include a newline, so you'll need to add
System.out.printf("%c, %d\n", x, v);