0

I tried to make a function that takes one argument (a number) and returns true/false if it has 6 inside of it. I know how to do that in python.

In python it should look like this:

def six(num):
    num=str(num)
    return "6" in num

How do I do it in Java?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63

1 Answers1

0
public boolean check(int x) {
    return Integer.toString(x).contains("6");
}