When it gets to lines 5 and 6, it DOESN'T know that the class and method exist. But it's not to hard to say "Well, I better be able to figure it out before I'm done. I'll just remember these two things, and I'll check again before I'm done looking at everything else that they are somewhere.".
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors