Why would you want to extend a class just to invoke a method? Inheritance is for a different purpose and cannot be compared with creating new instance.
And the way you are invoking in method in MyClass is wrong? Did you try to compile a similar code?
Not sure that we see enough information to know if the code works or not (I will clarify, the example of MyClass as literally spelled out won't work, I am referring to use of MyClass.method() itself). The method invocation from a class such as MyClass is only going to work on static methods. If it is an instance method, then you are going to need to access it from an instantiated object such as soc.method().
without a doubt, if all you are doing is using an existing method, do it the first way. extending classes is for if you want to override a method(change it's behavior). although i must admit i still usually extend JFrame when i could have one as a member variable instead. keep in mind that you can only extend one class, and some classes don't need to extend anything.
class should be extended for their structural behavior. i.e. if two classes have common common properties then it would be suitable to use extends.And should not be done only for code reuse.