State tax filing

I work in NYC and lived in NJ for all my life and in July I moved to NYC for 2 months then in September I decided to move back to NJ.  I think my employer said I will get 3 W-2s.  How will I file?