Prasanna Venkatesh is quite right.
You pass a name, then you pass K for a male, as command-line arguments.
You then give the "K" the misleading title of "event." It is not actually an event. Call the parameter something explanatory, like "sex."
You will have problems with the getPerson method. You have a return value for "K," but you don't have a return value for "L." The compiler will pick that up and throw error. You will have to add a line in your getPerson method, at the end
You have been told about factory methods, but what you have here is not a factory method. If it were a factory method you would pass "MaleFP" to the method and it would work out from that which class to instantiate.
You have also misunderstood the function of a constructor method. A constructor is a method which has no return type, and whose name (identifier) is
exactly the same as the name of the class (capitalisation included). What you have inside a constructor is code to set up (and maybe check and verify) the values of the fields to their initial value. So it would be appropriate to have a consrtuctor like this:
Only I would call "event" something different.
You ought not to print out from inside your constructor method; have a public void print() method in the PersonFP class.
As Prasanna Venkatesh has already told you, what you are doing is calling a method which creates an object, and sends it back. You can then do anything you want with any of the non-private methods of this object.
As Mohit Bahl has told you, you are not keeping the object in your main method. You have got a PersonFP object there, but have not given it a name (reference). That means you can't use it twice. If you want to use it twice, you will have to change the second line in your main method, from
to
Then, you can add lines like:
to your main method and see what happens.
CR