getIntent() is a member function of the Activity class. When you invoke it, the current class instance is referenced to return the Intent that activated it.
The following code elements do exactly the same thing as your example:
The second example works because your Activity is a subclass of android.app.Activity and it's that parent class that actually implements the getIntent() method. The first example is based on the idea that:
is implicitly defined by Java's inheritance mechanism. Assuming you don't override it with some other functionality, anyway!
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.