Actually, what's going on is that you are creating a new anonymous inner class which extends the abstract TimerTask class, and defining (overriding) the run() method of that class.
So, you aren't technically passing a method into the constructor... you're passing a new instance of a new class (that is anonymous -- has no name) that you're defining on the spot. (This class doesn't need to have a name, since it never gets used again... it existed just for the purpose of creating this object with this one overriden run() method.)
To learn more about how this works, see: https://www.javatpoint.com/anonymous-inner-class and https://stackoverflow.com/questions/355167/how-are-anonymous-inner-classes-used-in-java
Hope that helps!