
49 Cal.2d 668 (1958)
PAT P. MENDOZA, Respondent,
v.
SMALL CLAIMS COURT OF LOS ANGELES JUDICIAL DISTRICT, Appellant; MARY ARIZA, Real Party in Interest.
L. A. No. 24776. 
Supreme Court of California. In Bank.  
Jan. 28, 1958.
 Harold W. Kennedy, County Counsel, and William E. Lamoreaux, Assistant County Counsel, for Appellant.
 Ardy V. Barton for Respondent.
 TRAYNOR, J.
 In November, 1955, plaintiff brought a proceeding in unlawful detainer for default of rent in defendant small claims court. On December 6, 1955, the court dismissed the action upon its own motion on the ground that the 1955 amendment to section 117 of the Code of Civil Procedure, upon which its jurisdiction was predicated, was unconstitutional. From a judgment of the superior court that a writ of mandate issue compelling defendant to entertain the proceeding, defendant appeals.
 Section 117 of the Code of Civil Procedure gives justice court and municipal court judges jurisdiction to sit as small claims courts in cases for the "recovery of money only where the amount claimed does not exceed one hundred dollars ($100), except that a municipal court judge sitting as a small claims court shall also have jurisdiction in proceedings in unlawful detainer after default in rent for residential property where the term of tenancy is not greater than month to month, and where the whole amount claimed is one hundred dollars ($100) or less" (Italics added.) The unlawful detainer *670 provision was added in 1955. The jurisdictional amounts were increased to one hundred fifty dollars in 1957.
 The first issue to be decided is whether defendant court can question the constitutionality of the statute. [1] Plaintiff contends that defendant is not a member of a class whose rights are invaded by the statute and invokes the general rule that only such a member may question its constitutionality. (California State Automobile Ass'n Inter-Insurance Bureau v. Downey, 96 Cal.App.2d 876, 907 [216 P.2d 882].) The rule invoked by plaintiff is not absolute or all inclusive. (Pacific Indemnity Co. v. Myers, 211 Cal. 635, 644 [296 P. 1804]; People v. Globe Grain & Mill. Co., 211 Cal. 121, 128 [294 P. 3]; Quong Ham Wah Co. v. Industrial Acc. Com., 184 Cal. 26, 31-34 [192 P.2d 1021, 12 A.L.R. 1190]; see Golden Gate Bridge etc. Dist. v. Felt, 214 Cal. 308, 316-317 [5 P.2d 585].) Nor does it preclude a court from inquiring into its own jurisdiction or compel it to enter a judgment that it lacks jurisdiction to enter. [2] If a statute on which a court's jurisdiction in a proceeding depends is unconstitutional, the court has no jurisdiction in the proceeding, and since it may determine whether or not it has jurisdiction, it necessarily follows that it may inquire into the constitutionality of the statute (People ex rel. Smith v. Judge of the Twelfth District, 17 Cal. 547, 551; State ex rel. Coarsey v. Harrison, 107 Fla. 20 [144 So. 316, 317]; State ex rel. Turner v. Hocker, Circuit Judge, 36 Fla. 358 [18 So. 767, 768]; New York Life Ins. Co. v. Hardison, 199 Mass. 190 [85 N.E. 410, 412, 127 Am.St.Rep. 478]; State ex rel. Burg v. City of Albuquerque, 31 N.M. 576 [249 P. 242, 248]; State ex rel. Tod v. Court of Common Pleas of Fairfield County, 15 Ohio St. 377, 379, 381) and appeal from a judgment compelling it to proceed. (Simpson v. Police Court of Riverside, 160 Cal. 530, 532 [117 P. 553]; Modern Loan Co. v. Police Court, 12 Cal.App. 582, 584 [108 P. 56].)
 One of the alleged grounds of unconstitutionality of the amendment to section 117 of the Code of Civil Procedure is that it deprives a defendant of due process of law in that he may be deprived of possession of his residence without ever having had a hearing with the right to be represented by counsel, since he has no right to counsel in a small claims court (Code Civ. Proc.,  117g) and a stay of proceedings pending appeal is discretionary with the small claims court even though an appeal bond is filed. (Code Civ. Proc.,  1176.) Plaintiff contends, however, that there is an automatic stay on appeal when a proper undertaking is filed (citing sections 117j, 978, and 979 of the Code of Civil Procedure) *671 and that on appeal the defendant will have a trial de novo in the superior court with the right to be represented by counsel. (Code Civ. Proc.,  976.) [3] Sections 978 and 979, however, which govern appeals from justice courts and from small claims courts, as provided in section 117j, are essentially similar to sections 945 and 946, which govern appeals from superior courts. It has been held in numerous cases that in unlawful detainer actions sections 945 and 946 are subject to section 1176, which provides that a stay of proceedings on appeal is discretionary with the trial judge. The reasoning in those cases also applies to sections 978 and 979. (Jameson v. Chanslor-Canfield Midway Oil Co., 173 Cal. 612, 617 [160 P. 1066]; Sarthou v. Reese, 151 Cal. 96, 97 [90 P. 187]; Bateman v. Superior Court, 139 Cal. 140, 143 [72 P. 922]; Cluness v. Bowen, 135 Cal. 660, 661-662 [67 P. 1048]; Gross v. Kelleher, 73 Cal. 639, 640-641 [15 P. 362]; McDonald v. Hanlon, 71 Cal. 535, 536 [12 P. 515]; Woods-Drury, Inc. v. Superior Court, 18 Cal.App.2d 340, 349 [63 P.2d 1184]; see Code Civ. Proc.,  1174; 3 Cal.Jur.2d, p. 702; 3 Witkin, California Procedure, pp. 2197, 2198; Hunt, Manual of Unlawful Detailer Law in Calif., pp. 132-133.) [4] Moreover, the Legislature has specifically precluded the application of section 979 to stay proceedings in unlawful detainer actions. The 1955 amendment to section 117ha of the Code of Civil Procedure added the words "and the judgment may be enforced in the manner provided in section 1174 of the Code of Civil Procedure of the State of California." The applicable part of section 1174 provides that under certain limited circumstances the court may, within its discretion, permit the tenant to be restored to his estate upon payment. In all other cases the judgment may be enforced immediately and there is no provision for an automatic stay on appeal.  [fn. 1] Section 1176, which is complementary to section 1174, provides: "An appeal by the defendant shall not stay proceedings upon the *672 judgment unless the judge before whom the same was rendered so directs." Section 1178 provides that the unlawful detainer sections are controlling over "Part 2" of the Code of Civil Procedure.  [fn. 2] Part 2 includes section 979 and the sections relating to appeals from justice courts.
 Under the foregoing statutes a stay of proceedings on a judgment in unlawful detainer by the small claims court is discretionary with that court, and there is no automatic stay of proceedings whether or not an undertaking is filed.
 [5] When public necessity demands, there may be action followed by a hearing. (Financial Indemnity Co. v. Superior Court, 45 Cal.2d 395, 401 [289 P.2d 233]; Rhode Island Ins. Co. v. Downey, 95 Cal.App.2d 220, 235-237 [212 P.2d 965].) Otherwise due process requires that no person shall be deprived of a substantial right without notice and hearing. (McClatchy v. Superior Court, 119 Cal. 413, 418-421 [51 P. 696, 39 L.R.A. 691]; Havemeyer v. Superior Court, 84 Cal. 327, 400-401 [24 P. 121, 18 Am.St.Rep. 192, 10 L.R.A. 627]; People v. Lawrence, 140 Cal.App.2d 133, 136-137 [295 P.2d 4].) [6] Public necessity does not demand action before hearing in this proceeding by a landlord to regain possession of leased premises. Nor can there be any doubt that possession of a tenant is a substantial right. "The right to retain property already in possession is as sacred as the right to recover it, when dispossessed." (Hocking Valley Coal Co. v. Rosser, 53 Ohio St. 12 [41 N.E. 263, 265, 29 L.R.A. 386].) In Modern Loan Co. v. Police Court, 12 Cal.App. 582, 587 [108 P. 56], it was conceded that the person from whom personal property was taken could immediately maintain an action of claim and delivery, but the statute was nevertheless held unconstitutional. "This statute, however, does at least purport to authorize the magistrate to determine the right of actual possession of the property, and actual possession is a most valued right and is an essential part of property, and no one, consistent with constitutional safeguards, can be deprived of the possession or title to property, *673 or any other substantial right, without reasonable notice and opportunity to be heard."
 [7] The right to a hearing includes the right to appear by counsel. (Chandler v. Fretag, 348 U.S. 3, 9-10 [75 S.Ct. 1, 99 L.Ed. 4]; Powell v. Alabama, 287 U.S. 45, 68-70 [53 S.Ct. 55, 77 L.Ed. 158, 84 A.L.R. 527]; Cooke v. United States, 267 U.S. 517, 537 [45 S.Ct. 390, 69 L.Ed. 767]; Steen v. Board of Civil Service Commrs., 26 Cal.2d 716, 727 [160 P.2d 816]; Roberts v. Anderson, 66 F.2d 874, 876; Prudential Ins. Co. v. Small Claims Court, 76 Cal.App.2d 379, 381-382 [173 P.2d 38, 167 A.L.R. 820].) In its consideration of the right to counsel in Powell v. Alabama, supra, 287 U.S. at 68-69, the United States Supreme Court declared: "What, then does a hearing include? Historically and in practice, in our country at least, it has always included the right to the aid of counsel when desired and provided by the party asserting the right. The right to be heard would be, in many cases, of little avail if it did not comprehend the right to be heard by counsel. Even the intelligent and educated layman has small and sometimes no skill in the science of law ... If in any case, civil or criminal, a state or federal court were arbitrarily to refuse to hear a party by counsel, employed by and appearing for him, it reasonably may not be doubted that such a refusal would be a denial of a hearing, and, therefore, of due process in the constitutional sense."
 In Prudential Ins. Co. v. Small Claims Court, supra, 76 Cal.App.2d at 382, upholding the small claims court act, it was stated: "It is urged that depriving a litigant of the right of counsel is a violation of due process. There can be little doubt but that in both civil and criminal cases the right to a hearing includes the right to appear by counsel, and that the arbitrary refusal of such right constitutes a deprivation of due process." The requirements of due process were met, however, since a plaintiff need not elect to sue in a small claims court and a defendant has a right to appeal to the superior court where he may have a trial de novo and be represented by counsel and the automatic stay precludes a deprivation of property until the appeal is determined. (Code Civ. Proc.,  117j, 978, 979.) [8] In the present case the right to counsel on appeal cannot save the amendment, for there is no automatic stay and the defendant may be dispossessed prior to the trial de novo. (Code Civ. Proc.,  1176.)
 The 1955 amendment to section 117 of the Code of *674 Civil Procedure is therefore void insofar as it purports to give jurisdiction to small claims courts in unlawful detainer proceedings. The invalidity of this amendment does not invalidate the entire section. (Speegle v. Board of Fire Underwriters, 29 Cal.2d 34, 47-48 [172 P.2d 867]; Danskin v. San Diego Unified School Dist., 28 Cal.2d 536, 555 [171 P.2d 885].)
 The judgment is reversed.
 Gibson, C.J., Shenk, J., Carter, J., Schauer, J., Spence, J., and McComb, J., concurred.
 "When the proceeding is for unlawful detainer after default in the payment of rent, and the lease or agreement under which the rent is payable has not by its terms expired, and the notice required by Section 1161 has not stated the election of the landlord to declare the forfeiture thereof, the court may ... order that execution upon the judgment shall not be issued until the expiration of five days after the entry of judgment, within which time the tenant, or any subtenant, or any mortgagee of the term, or any other party interested in its continuance, may pay into the court, for the landlord, the amount found due as rent, with interest thereon, and the amount of the damages found by the jury or the court for the unlawful detainer, and the costs of the proceedings, and thereupon the judgment shall be satisfied and the tenant be restored to his estate."
 "But if payment as here provided be not made within five days, the judgment may be enforced for its full amount, and for the possession of the premises. In all other cases the judgment may be enforced immediately."
NOTES
[fn. 1]  1. The applicable part of section 1174 reads as follows:
[fn. 2]  2. "The provisions of Part 2 of this code, relative to new trials and appeals, except insofar as they are inconsistent with the provisions of this chapter or with rules adopted by the Judicial Council apply to the proceedings mentioned in this chapter." (Code Civ. Proc.,  1178.)
