Except as provided in section seven hundred thirty-two of this article, relating to a proceeding for non-payment of rent, at the time when the petition is to be heard the respondent, or any person in possession or claiming possession of the premises, may answer, orally or in writing. If the answer is oral the substance thereof shall be recorded by the clerk or, if a particular court has no clerk, by the presiding judge or justice of such court, and maintained in the case record. The answer may contain any legal or equitable defense, or counterclaim. The court may render affirmative judgment for the amount found due on the counterclaim.
N.Y. Real Prop. Acts. Law § 743