The Code, by section 33, subdivision 3, defines the jurisdiction of the Court of Common Pleas over actions against foreign corporations, and confers it only where the action is for a debt or damages, whether liquidated or not, arising upon contract made, executed, or delivered in this State, or where the cause of action arises therein. Section 42J provides that an action may be commenced in the Supreme Court, the Superior Court of the City of Uew York, and in the Court of Common Pleas for the City and County of Hew York, *286by a resident of this State, for any canse of action; and by a plaintiff not a resident, when the cause of action shall arise, or the subject of the action shall be situate within this State.
To enable a non-resident plaintiff to mantain an action, therefore, in this court,. against a foreign corporation, one of three requisites, at least, must appear :
1. That the action is upon a contract made, executed, or delivered in this State; or,
2. That the cause of action shall have arisen in this State; or,
3. That the subject of the action shall be situate within this State. Here none of these requisites exist. The plaintiff is a non-resident, and the cause of action arose in the State of Hew Jersey. He has, therefore, no status in this court, and his action cannot be entertained.
It was urged on the argument, that the defendants having appeared and answered, without raising any objections to the jurisdiction of this court, and this court having jurisdiction of cases brought to recover damages for injuries done by railroad companies, the question was one which related to the person, and not to the subject matter. The answer to this proposition is, that the statute has declared, in effect, that this court shall not have jurisdiction of such actions against a foreign corporation unless the plaintiff resides in this State, or the cause of action arose therein. It has jurisdiction of all actions between individuals for injuries inflicted, without regard to the residence, when the defendant is personally served with process within the city of Hew York, but against foreign corporations only in the cases specified. The objection, therefore, urged by the defendants does not present a question of jurisdiction over the person. We have decided that a defendant, by appearing and pleading to the merits, waives all objections of jurisdiction to the person, but not to the subject-matter. (Hogan a. Baker, 2 E. D. Smith, 22 ; Palding a. Hudson Railroad Company, Ib. 38.)
And the Court of Appeals have decided that no assent by the parties can confer jurisdiction, or render the judgment of a tribunal effectual, in a matter over which it has not, by law, jurisdiction. (Dudley a. Mayhew, 3 Comst., 12; Binckle a. Eckhart, Ib., 132; see also Coffin a. Tracy, 3 Cai., 129; Daws a. Packard, 7 Pet. 276; United States a. Yale, 6 How. (U. S.) R., 605 ; United States a. Carnes, Ib., 106.)
*287In Dudley a. Mayhew (supra), the objection to the jurisdiction was first interposed by plea, but subsequently withdrawn, and a stipulation given not to raise it further; but as consent could not give jurisdiction, the decree of the chancellor was reversed.
The judgment should be affirmed.
II. February, 1859.—Motion to vacate judgment.
After the decision affirming the dismissal of the complaint, the defendants entered judgment for costs of the appeal. The plaintiff, upon an affidavit stating that he was a non-resident, and reciting the foregoing proceedings in "the cause and that he was advised that the judgments for costs were void, and upon the judgment-rolls and the opinion of the court, moved, at special term, to set aside and vacate the judgments, on the ground that they were void.
J. W. Gerard, for the motion. This court having decided that they had nothing to do with this cause, having no jurisdiction over the subject-matter, which decision was not the result of the trial of any issue in fact or in law, this court cannot award a judgment for costs to the defendant.
They either have nothing to do with it, or they have. If they have, they should have tried it; if not, then they can make no judgment for a recovery, either by the one party or the other.
The court will bear in mind that the defendants submitted to the jurisdiction by appearing generally and answering to the merits, without taking the ground of want of jurisdiction in their answer and forming an issue thereon, but going to trial before the court and jury, and taking the risk of getting a verdict on the merits; but the jury disagreeing, there was no verdict, although it appeared on the first trial that the ¡plaintiff was a nonresident ; and the ground was never suggested until the second trial—the one in question. The defendants also knew it before the first trial, for on that ground they moved for security for costs.
I. Where a court has no jurisdiction over the subject matter, which cannot, be waived even by consent, they can make no judgment in the cause for costs in favor of the defendants againsu the plaintiffs. Such is the general rule at common law, although there always was a statute fee-bill, as now, and the Code has *288not altered the common law in that respect. (9 Johns., 239 ; 6 Wend., 465.) In 2 Rev. Laws of 1813, § 103 of the act relating to justices’ courts in the city of Hew York, where a plaintiff brings his suit in the wrong ward, the justice shall dismiss the case, with costs, the same as if nonsuited on the merits. This shows that, without such express legislation, no costs could be allowed.
II. Has the Code given costs in such a case? Before the court awards them it must appear, beyond all doubt, that the codifiers have done so. Sections 304 and 305 of the Code only apply to the trial of causes on the issues framed, either of fact or of law. Those sections apply to trials, not where there is no trial; and their construction must depend upon other sections, with which they are in connection. Section 304 says the plaintiff shall have costs in case of a recovery by him, meaning an actual recovery on the trial of an issue in law or in fact; but not where there has been no trial, and where there could be no recovery ; and section 405 gives costs to the defendant, of course, only where the defendant, after having had a chance, by trial, of recovering on an issue of fact or law,-fails to recover on the merits of some issue. Sections 248, 249, and 250 show that no issue was joined in this case, either of law or fact-, upon the ground on which the judge refused to try the cause. Section 252 shows that there was no trial in this case, as that section defines a trial to be “ a judicial examination of the issues between the parties, whether they be of law or fact.” Section 245 : “ A judgment is the final determination of the rights of the parties in the action,”—meaning on the merits, as declared by issues. There can be no judgment where there is no trial. There may be an order, not a judgment. Here this court and the judge on the trial may direct an order to be entered, by the clerk, on the minutes, that they have no jurisdiction, and that they dismiss the complaint therefor, and that is all. A judgment-roll for the defendants would debar the plaintiff from bringing a suit in Hew Jersey against the defendants. By section 144, the defendant may form an issue at law on the question of jurisdiction, where it appears on the face of the complaint, by demurrer. By section 147, objections to the jurisdiction may be taken by answer, where it does not appear on the face of the complaint, thus forming an issue in fact. By section 148, omitting to demur or *289answer does not waive objections to jurisdiction. But that does not touch the question of costs. The intention of these last sections is, that a party shall take objection at the first opportunity by tendering an issue, and the extent that the defendant can claim, from any construction of those sections, is, that if such issue so insisted upon is made and argued, or tried, that the court, under the general power of awarding costs on an issue tried or argued, may give the defendant costs. But that I do not concede.
But if the defendant takes no such defence, makes no such issue, but it is left to the judge at the trial, either on his own motion, or the suggestion of the defendant’s counsel, or any one else, that he has no jurisdiction to try the cause, and he so declares, he sends the parties away, breaks up the jury, and may enter an order on the minutes to that effect; but no judgment for costs can be entered up for defendants, because no issue has been tried, and there can be no costs without a judgment, and no judgment without jurisdiction.
In the case in 22 Barb., 271, the judgment was for the plaintiffs below on the merits; the court deciding against the defendant on the question of jurisdiction. The court above reversed the court below, on the ground that the court below had not jurisdiction. The Supreme Court held that they had jurisdiction to reverse the judgment, and to grant the costs in that court of such reversal. They decided that if the want of jurisdiction appeared before the justice, on the face of the papers, he should dismiss the case without costs, and in such cases the appellant cannot recover costs in the Supreme Court for the proceedings in the County Court.
When want of jurisdiction is presented by plea or demurrer, the court has jurisdiction to determine and pass upon the question presented, and in such case the party prevailing is entitled to costs; and in order to give the appellants the costs of the appeal in the Supreme Court, the whole first part of the opinion is labored to show that this appeal from a County Court to the Supreme Court was a new suit, and not a continuance of the original suit. That state of facts is wanting here, because this cause, before this general term, was not a new suit, but was a mere continuance of the old one in the same court. This case cites numerous others which show that no costs can he adjudi*290cated where there is no jurisdiction ; and if this case had been in the Common Pleas from an appeal from its own special term, they would not have allowed costs even on the argument of the appeal; and when they finally gave the costs of that court to the appellant, on the ground of its being the Supreme Court, a court of the highest jurisdiction which had a right, by the constitution, to review, by a certiorari, the judgments of all inferior courts, they finally reversed all the judgments of the County Court, or rather, the doings of their clerk, who, as in this case, as a matter of course, had awarded to some of the appellants costs in the County Court below. (See also Manfield a. Levy, 4 Dall., 338 ; Dudley a. Mayhew, 3 Comst., 19.)
E. S. Van Winkle, opposed—I. The plaintiff appealed from this j udgment as a whole, but took no exception to that part of it which allowed costs. On the appeal, the judgment was affirmed and entered up with the additional costs on appeal. The plaintiff now appeals from the allowance of costs on the judgments, on the ground that the court, having no jurisdiction of the subject-matter of the suit, could not award costs. By the Code (§ 303), all previous statutes regulating costs were repealed. Section 304 provides that costs shall be allowed, of course, to the plaintiff, upon a recovery in the cases therein enumerated, which are an action like the present. Section 305 says that costs shall be allowed, of course, to the defendant in these cases, unless the plaintiff be entitled to costs therein. Section 306 relates to cases in which the court may exercise its discretion in allowing costs or not. This is clear and positive ; and as the plaintiff is clearly not entitled to costs, the defendants clearly are, and the court has no discretion in the matter. This language differs from the old statutes. (1 Rev. L., 343.) It must be an action in which the plaintiff might have costs in case judgment was given for him, failure in which entitled the defendant to them ; but, under the Code, the defendant must have costs if the plaintiff is not entitled to them. That is a broader and more equitable rule. The language of the Revised Statutes (2 Rev. Stat., 615), is similar to the act of 1813. Under the old laws, the court directed the judgment with or without costs; now the clerk adds the costs by direction of the statute. What is now allowed, under the term costs, is not what was formerly given as a mere incident to damages; but *291there are allowed to the prevailing party, upon the judgment, certain sums by way of indemnity for his expenses in the action, which allowances are, in the Code, termed costs (§ 303).
II. This matter, depending on a special statute, must be controlled by it; and decisions in other States and countries, proceeding under different statutes, or without any, have no application. In the case of Williams a. Blunt (2 Mass., 207), the defendant, on the appeal to the Superior Court, had been the plaintiff in the original suit, and was he who instituted the proceeding in a court having no jurisdiction. But in Thomas a. White (12 Mass., 370), the court, distinguishing the case from the last one, says, it is only by the plea of the defendant, in which there must be an issue and a judgment, that the want of jurisdiction of this particular suit can be ascertained; and they gave judgment for the defendant, with costs. (See also Guild a. Richardson, administrator, 6 Pick., 364. Clark a. Rockwell, et al. (15 Mass., 212), was decided on the authority of Williams a. Blunt, supra) In this State there have been but few decisions on the point.. In Ex parte Root (1 Cow., 518), a mandamus was moved for, opposed, and denied, yet the court gave costs against the mover, though no cause had been commenced.
In Ex parte Davis a. Soule (5 Cow., 33), the Supreme Court held, that though a Court of Common Pleas cannot entertain jurisdiction of a cause on appeal if the bond be defective, yet, on quashing the appeal for that cause, the parties being before them, they had jurisdiction of their persons for the purpose of awarding costs against them. Ex parte Benson (6 Cow., 592), Ex parte Mallard (6 Cow., 593), and Ex parte Mallard (7 Cow., 423), affirm this rule, and aver a power to give costs of application to dismiss for want of jurisdiction. In the case in 6 Cow., 593, the court did not decide that the general costs could not be awarded, but held that the court below, in refusing them, had rightly exercised a sound legal discretion. In the United States Supreme Court the rule appears to be, that costs will be allowed upon a dismission of a writ of error for want of jurisdiction, if the original defendant be also defendant in error. (Winchester a. Jackson, 3 Cranch, 514.) Subsequently, in Montalet a. Murray (4 Ib., 46), judgment was reversed for want of jurisdiction, and with costs; but on the last day of the term the court gave this general direction to the clerk: That in case of reversal, *292costs do not go, of course; but in all cases of affirmance they do; and that when a judgment is reversed for want of jurisdiction, it must be without costs. The reason of a distinction is apparent. In Ingler a. Coolidge (2 Wheat., 363), the defendant below was the plaintiff above, and the want of jurisdiction was not in the court below, but in the appellate court. Maxwell’s Lessee a. Levy (4 Dall., 330), (1797), was a motion, before trial, to dismiss a case for want of jurisdiction, and was granted, but without costs. Frees a. Ford (2 Seld., 176) was an appeal by the defendant below, so that it did not come within the rule laid down in Cranch ; but the court, on the ground of want of jurisdiction in the court below, reversed the judgment. Costs, of course, followed. So Kundolf a. Thalheimer (2 Kern., 593) was an appeal by the defendant. The want of jurisdiction appeared by the pleadings, the court reversed the judgment for this cause, and costs must have followed.
In 5 Metcalf, 240, Wild, J., says: “In all cases where the want of jurisdiction does not manifestly appear on the face of the writ, and the question of jurisdiction is a fair subject for discussion, and for the decision of the court, there seems to be no reason why the defendant, if he prevail on the decision of the question in his favor, should not be entitled to costs.” (To same effect is 7 Metc., 590. See also 3 Seld., 576.) In Gormly a. McIntosh (22 Barb., 271), it was held that where an appeal is taken to the Supreme Court, from a judgment of a County Court, on the ground that the latter court had no jurisdiction of the subject-matter for which the action was brought, the Supreme Court has jurisdiction to reverse the judgment, and to award to the appellant his costs in that court. But where the want of jurisdiction is apparent on the face of the summons and complaint, the County Court should dismiss the suit without costs. And in such cases the appellant cannot recover costs in the Supreme Court for the proceedings in the County Court. Where the want of jurisdiction does not appear upon the face of the proceedings, but is presented by plea or demurrer, the court has jurisdiction to pass upon and determine the question presented; and in such a case the party prevailing is entitled to costs.
III. The Code allows the defendant to raise the question of jurisdiction by demurrer (§ 144), or answer (§ 141); or without *293either, he may raise it on the trial (§ 148). The non-residence of the plaintiff did not appear by the complaint, therefore defendant conld not demur. The defendant did not know of the non-residence until after answer put in, as appears by the application for security for costs on the ground of plaintiff’s non-residence, made since this after issue. The only other way was to prove it on the trial. The defendants, therefore, lost no right in this matter; and whether there was an issue or not, or a trial or not, as the plaintiff was not entitled to costs in this action, the defendants were entitled. If the court can give or refuse costs in this case, in its discretion, it should award them. 1. Because the plaintiff, who impleaded the defendants, did so wrongfully. 2. Because he wilfully or negligently concealed the fact that he was a non-resident. 3. Because, after the court had decided he was wrong, he continued his cause by appeal. 4. Because neither on the taxation of first bill of costs, nor on his appeal, did he objéct to the allowance of costs' if defendant was entitled to judgment. 5. Because the allowance is made by way of indemnity for expenses the prevailing party has suffered. 6. The costs of the appeal should be allowed on the principle of the three cases in Cowen, being equivalent to costs on the motions to dismiss in those cases. If this question be res integra under the Code, and such it appears to be, then the rule should be established on the general principle that the prevailing party shall have costs. It seems as inconsequential to say that if one party impleads another in a court where he has no right to do it (putting his opponent to the necessity of appearing, however, and defending his rights), he may do so with impunity as to costs, because he has acted without a shadow of right, as it would be to say that a plaintiff nonsuited for want of statement of a sufficient cause of action shall not pay costs, because he clearly had no right of action. But, under the old decisions, two rules seem to be established. First—That if the defendant on appeal is the defendant below, and the judgment is affirmed, he shall recover costs; and Secondly—That if the complaint does not show, on its face, the want of jurisdiction, which, however, is made to appear by plea, or admission, or proof, that then costs shall be awarded as in other cases.
Hilton, J.The plaintiff brought his action in this court to *294recover damages from the defendants, a company incorporated by the Legislature of ¡New Jersey, for the injuries he sustained by their negligence in running upon their rail-track, in Essex county, in that State, in so careless a manner as to kill a bay mare belonging to him.
The defendants answered, denying carelessness or negligence on their part; and the issue thus presented was called on for trial before Judge Daly, in May, 1858, when it appearing, from the admission of the counsel for the plaintiff', that the plaintiff" was a resident of Slew Jersey, the complaint was dismissed upon the ground that the court had no jurisdiction of the action. (Code, § 427.)
From this order, an appeal was taken to the general term, where it was affirmed.
Upon the presumed authority of the decisions thus made, the clerk has entered judgment against the plaintiff in favor of the defendants for the costs in the action and on the appeal, and which the plaintiff now asks to have vacated, for the reason that as this court determined it had no jurisdiction of the subject-matter of the action, it can give no judgment; that in such a case it can only dismiss the action for want of power to entertain or determine it, leaving the parties in the condition it found them.
The right of a party to costs is given by statute, and as the Code has abolished all previous laws upon the subject, the question here presented must be determined by reference to provisions of that enactment. (Supervisors of Onondaga a. Briggs, 3 Den., 173.)
Upon the argument, the counsel for the defendant referred to numerous cases, showing the practice of appellate tribunals to award costs on dismissing appeals for want of jurisdiction, or on reversing a judgment appealed from upon the ground that the inferior tribunal had no jurisdiction of the action ; but a careful examination" of the cases will show that this "practice proceeds upon the idea that the. appeal confers a new jurisdiction in the appellate court, and is not a mere continuation of the same suit. (Traver a. Nichols, 7 Wend., 434; Striker a. Mott, 6 Ib., 465 ; Fenno a. Dickinson, 4 Den., 84; Gormly a. McIntosh, 22 Barb., 271.)
In many cases, the object of the appeal is to have determined *295whether the judgment appealed from is within the jurisdiction of the court that gave it; ■ and apart from any express law on the subject, where that question is a fair subject for discussion, and for the decision of the appellate court, there is an obvious propriety in allowing costs of the appeal to the party in whose favor the question is decided. (Canter a. American Insurance Company, 3 Pet., 318; Osgood a. Thurston, 23 Pick., 110; Thomas a. White, 12 Mass., 370; Cary a. Daniels, 5 Metc., 236, 240 ; Turner a. Blodgett, Ib., 241.)
It is not, however, necessary for the purposes of this motion, that the practice of the appellate court to which I have re-, ferred should be inquired into, further than to show its existence, and to refer in support of it to the very able opinion of Judge E. Darwin Smith, in Gormly a. McIntosh (22 Barb., 271, supra), on the subject. But whether their right to award costs in such cases is original and inherent, or whether it depends upon the statutes which give the appeal, it is quite clear to my mind that the question here presented for determination must depend upon the provisions of the Code, without reference to this practice or the reasons for its adoption.
By section 303 of the Code, which repeals all former statutes establishing or regulating costs in civil actions, it is provided that certain sums enumerated in subsequent sections may be allowed “ to the prevailing party on the judgment,” by way of indemnity for his expenses in the action, and which allowances are termed costs.
■ The costs here referred to are incident to and follow upon the judgment given, and as a judgment is, by section 245, defined to be a “ final determination of the rights of the parties in the action,” it seems to me that, until there has been such final determination, there .can be no prevailing party entitled to costs. (See Williams a. Blunt, 2 Mass., 214).
If the plaintiff had stated in his complaint that he resided in Hew Jersey, and the defendants had demurred on the ground that this court had not jurisdiction of the subject of the action, a trial of the issue of law thus presented (§ 252) would result in a final determination ; and a judgment given therein would entitle the prevailing party to the costs allowed by section 303.
Or if the defendants, instead of proceeding to trial, had, upon *296a motion, established the fact of the plaintiff’s non-residence by affidavits, to the satisfaction of the court, the action would have been dismissed for want of jurisdiction to entertain it, and costs might have been allowed under section 315.
But the defendants do not come within either of these provisions in respect to costs, and I do not know of any principle of law under which they can retain the judgment they have entered.
We have declared at special and general term, that the Code did not give us jurisdiction to hear or determine an action of .this nature, where the plaintiff is a non-resident, and for that reason dismissed it, without giving any judgment, or determining in the slightest degree the rights of the parties ; their condition has been in no respect changed, and if, as the defendants say, they have been unnecessarily put to expense in defending a useless proceeding which the plaintiff instituted, they may be answered, that they could have taken advantage of the plaintiff’s non-residence by motion to dismiss the action at any time during the progress of the cause, and for that reason ought not to recover the costs of preparing for trial. (Bridge a. Payson, 5 Sandf., 217.)
I do not, however, place my decision upon any such ground, 'but rest it upon the general principle stated by Chief-justice Kent, in the matter of Perguson (9 Johns., 239), “ that if a court has no jurisdiction of the principal question, it has none of its consequences and incidents.”
As I have already stated, costs are an incident to the judgment, and having no power to give the one, we cannot award the other, unless -expressly authorized so to do by statute ; and as we have seen that there exists no such authority, it follows that the judgment entered must be vacated.
Present, Daly, F. J., Brady and Hilton, JJ.