
9 Cal.Rptr.3d 503 (2004)
115 Cal.App.4th 608
In re CHARLES G., a Person Coming Under the Juvenile Court Law.
The People, Plaintiff and Respondent,
v.
Charles G., Defendant and Appellant.
No. C041288.
Court of Appeal, Third District.
February 5, 2004.
Review Denied April 21, 2004.[*]
*504 Rachel Lederman, San Francisco, under appointment by the Court of Appeal, for Defendant and Appellant.
*505 Bill Lockyer, Attorney General, Robert R. Anderson, Chief Assistant Attorney General, Jo Graves, Senior Assistant Attorney General, Patrick J. Whalen and Susan J. Orton, Deputy Attorneys General, for Plaintiff and Respondent.
SCOTLAND, P.J.
Juvenile delinquency laws permit a juvenile court to retain jurisdiction over a ward until he or she reaches the age of 21 or, in some circumstances, the age of 25. (Welf. & Inst.Code, § 607, subds. (a) & (b); further section references are to the Welfare and Institutions Code.)
Charles G. (appellant), still a ward of the juvenile court at the age of 20 based upon his delinquent conduct, violated terms of his probation. Probation was reinstated on the condition that he serve a period of confinement. On appeal, he contends that (1) the juvenile court lacked authority to detain him in an adult facility pending the hearing on whether he violated probation, and (2) after finding that he did violate terms of his probation, the court lacked authority to sanction him with further confinement in the adult facility.
Although the appeal is now moot because appellant has served his term of confinement and his probation has been terminated, he asks us to rule on the merits because the issues are of continuing public concern and are likely to recur. (See In re Christina A. (2001) 91 Cal.App.4th 1153, 1159, 111 Cal.Rptr.2d 310.) For guidance of the juvenile court, we shall address the merits of appellant's claims of error and then dismiss the appeal as moot. (See Daly v. Superior Court (1977) 19 Cal.3d 132, 140, 151, 137 Cal.Rptr. 14, 560 P.2d 1193; People v. West Coast Shows, Inc. (1970) 10 Cal.App.3d 462, 468, 471, 89 Cal.Rptr. 290.)
We conclude that when a ward of the juvenile court who is 19 years of age or older violates probation, the juvenile delinquency laws allow the ward to be detained in, and ultimately confined in, an adult detention facility as punishment for the violation of probation. As we will explain, when the juvenile court has retained jurisdiction over a ward who is 19 or older and who is alleged to have violated terms of his or her probation, the ward may not be directly detained in a local adult detention facility pending the probation revocation hearing. And if found to have violated probation, the ward may not be directly committed to a period of confinement in the adult facility. However, section 208.5 authorizes the juvenile court to order the ward detained in a juvenile facility and then, upon recommendation of the probation officer, delivered to a local adult detention facility until the probation revocation hearing. Likewise, if the ward is found to have violated probation, sections 202 and 208.5 authorize the court to order the ward to be confined in a juvenile facility and then, upon recommendation of the probation officer, immediately delivered to a local adult facility to serve the period of confinement. In reaching these conclusions, we disagree in part with the holding in In re Kenny A. (2000) 79 Cal.App.4th 1, 93 Cal.Rptr.2d 678.

FACTUAL AND PROCEDURAL BACKGROUND
At the age of 15, appellant admitted committing vandalism and battery. He was adjudged a ward of the juvenile court (§ 602) and was placed on probation. Over the next five years, appellant repeatedly violated the terms of his probation by committing new crimes, by failing to keep in contact with his probation officer, and by testing positive for drugs. Each time, he was continued on probation and various placements were tried.
*506 When appellant was 20 years old and still on probation, his probation officer filed a pleading alleging that appellant violated terms of his probation by testing positive for methamphetamine and marijuana, and by failing to keep in contact with the probation officer. Appellant was taken into custody and, because he was over the age of 19, the probation department obtained a juvenile court order placing him in the Lassen County Adult Facility (county jail) pending the detention hearing. At the detention hearing, the juvenile court found a prima facie showing was made that appellant had violated his probation. The court further found that returning appellant to his home pending the probation violation hearing would be contrary to his welfare. Hence, the court ordered the detention to continue in the county jail.
Appellant ultimately admitted the two allegations that he had violated terms of his probation. Finding appellant should not be "rewarded" for his misconduct "by simply having ... jurisdiction terminated" due to his age, the court continued him as a ward and ordered him to serve a period of confinement "in an authorized facility," with the understanding that, once the time was served, jurisdiction over appellant would be terminated.

DISCUSSION
Appellant contends that the juvenile court had no authority to grant the probation department's motion to detain him in a local adult facility and that, after finding appellant violated probation, the court exceeded its jurisdiction by imposing a period of confinement with the understanding that he would serve his time in a local adult facility. We disagree.

A
When a minor is found to be a ward of the juvenile court, the court may retain jurisdiction over the person until he or she turns 21 years old (§ 607, subd. (a)), or 25 years old if the person has been committed to the California Youth Authority for a crime "listed in subdivision (b), paragraph (2) of subdivision (d), or subdivision (e) of Section 707...." (§ 607, subd. (b).)
Consequently, as we will explain, if a ward is placed on probation and then violates its terms after the ward turns 18, the juvenile court may have jurisdiction to detain the ward and to impose an appropriate sanction, including punishment in the form of confinement. Here, appellant was still a ward of the court at the age of 20 when he was detained and then committed for a period of confinement for violating the terms of his probation.
The authority to detain the 20-year-old appellant in a local adult detention facility derives from section 208.5, which states: "Notwithstanding any other provision of law, in any case in which a minor who is detained in or committed to a county institution established for the purpose of housing juveniles attains the age of 18 prior to or during the period of detention or confinement he or she may be allowed to come or remain in contact with those juveniles until the age of 19, at which time he or she, upon the recommendation of the probation officer, shall be delivered to the custody of the sheriff for the remainder of the time he or she remains in custody, unless the juvenile court orders continued detention in a juvenile facility. The person shall be advised of his or her ability to petition the court for continued detention in a juvenile facility at the time of his or her attainment of the age of 19. Notwithstanding any other provision of law, the sheriff may allow such a person to come into and remain in contact with other adults in the county jail or in any other county correctional facility in which he or *507 she is housed." (Italics added; § 15 ["`Shall' is mandatory and `may' is permissive"]; see also § 737.)
The authority to punish appellant for violating terms of his probation derives from section 202, which states in pertinent part that "[m]inors under the jurisdiction of the juvenile court as a consequence of delinquent conduct" may receive "punishment that is consistent with the rehabilitative objectives of this chapter." (§ 202, subd. (b).) "As used in [subdivision (b)], `punishment' means the imposition of sanctions.... Permissible sanctions may include the following: [¶] (1) Payment of a fine by the minor. [¶] (2) Rendering of compulsory service without compensation performed for the benefit of the community by the minor. [¶] (3) Limitations on the minor's liberty imposed as a condition of probation or parole. [¶] (4) Commitment of the minor to a local detention or treatment facility, such as a juvenile hall, camp, or ranch. [¶] (5) Commitment of the minor to the Department of the Youth Authority. [¶] `Punishment,' for the purposes of this chapter, does not include retribution." (§ 202, subd. (e).)
Although these statutes refer only to "a minor" or "[m]inors," the application of well-established rules of statutory construction leads to the conclusion that sections 202 and 208.5 apply to a person (1) who was declared a ward of the juvenile court while a minor (§ 602), (2) who became an adult upon turning 18 (Fam.Code, §§ 6500, 6501) but remained under the jurisdiction of the juvenile court (§ 607, subds.(a) & (b)), and (3) who violated juvenile court probation after becoming an adult.
Statutory interpretation entails ascertaining the intent of the Legislature in order to effectuate the purpose of the law. (People v. Mendoza (2000) 23 Cal.4th 896, 907, 98 Cal.Rptr.2d 431, 4 P.3d 265.) Courts begin "by examining the statute's words, giving them a plain and commonsense meaning." (Ibid.) "In doing so, however, we do not consider the statutory language `in isolation.' [Citation.]" (Ibid.) Rather, we construe the words of the statute "`in context, keeping in mind the nature and obvious purpose of the statute....' [Citation.]" (West Pico Furniture Co. v. Pacific Finance Loans (1970) 2 Cal.3d 594, 608, 86 Cal.Rptr. 793, 469 P.2d 665.) In other words, we "must harmonize `the various parts of a statutory enactment ... by considering the particular clause or section in the context of the statutory framework as a whole'" (People v. Mendoza, supra, 23 Cal.4th at p. 908, 98 Cal.Rptr.2d 431, 4 P.3d 265), so that all of the statutes in the scheme will "have effect." (Travelers Indemnity Co. v. Gillespie (1990) 50 Cal.3d 82, 100, 266 Cal.Rptr. 117, 785 P.2d 500.) And "[w]e must also avoid a construction that would produce absurd consequences, which we presume the Legislature did not intend." (People v. Mendoza, supra, 23 Cal.4th at p. 908, 98 Cal.Rptr.2d 431, 4 P.3d 265; accord, Flannery v. Prentice (2001) 26 Cal.4th 572, 578, 110 Cal.Rptr.2d 809, 28 P.3d 860.)
The purpose of juvenile delinquency laws is twofold: (1) to serve the "best interests" of the delinquent ward by providing care, treatment, and guidance to rehabilitate the ward and "enable him or her to be a law-abiding and productive member of his or her family and the community," and (2) to "provide for the protection and safety of the public...." (§ 202, subds. (a), (b) & (d); In re Myresheia W. (1998) 61 Cal.App.4th 734, 740, 741, 72 Cal.Rptr.2d 65; In re Jimmy P. (1996) 50 Cal.App.4th 1679, 1684, 58 Cal.Rptr.2d 632.)
To accomplish these purposes, the juvenile court has statutory authority to order *508 delinquent wards to receive "care, treatment, and guidance that is consistent with their best interest, that holds them accountable for their behavior, and that is appropriate for their circumstances. This guidance may include punishment that is consistent with the rehabilitative objectives of [the juvenile court law]...." (§ 202, subd. (b).)
More specifically, section 727 states the juvenile court "may make any and all reasonable orders for the care, supervision, custody, conduct, maintenance, and support of the minor ..., subject to further order of the court. ..." (Italics added.) (§ 727, subd. (a).) "[A] ward may be ordered to be on probation," either with or without supervision of the probation officer, and "[t]he court, in so ordering, may impose on the ward any and all reasonable conditions of behavior as may be appropriate under this disposition...." (Ibid.)
Section 726 explicitly acknowledges "the power of the court to retain jurisdiction over a minor and to make appropriate orders pursuant to Section 727 for the period permitted by Section 607." (Italics added.)
By authorizing the juvenile court to punish a delinquent minor "subject to further order of the court" (§ 727, subd. (a)) and to make appropriate orders pursuant to section 727 "for the period permitted by Section 607" (§ 726), i.e., until the ward "attains the age of 21 years" or, in some cases, "until that person attains the age of 25 years if the person was committed to the Department of the Youth Authority" (§ 607, subds. (a) & (b)), the Legislature has expressed an intention to authorize a juvenile court to impose a new order of punishment when a ward who has become an adult violates a condition of his juvenile court probation.
Consistent with the purpose of juvenile delinquency laws, as articulated by the Legislature in section 202, and the statutory authority given to juvenile courts by sections 202, 726, and 727, we interpret section 202, subdivision (e), and section 208.5 to apply to a person (1) who was declared a ward of the juvenile court while a minor, (2) who became an adult upon turning 18 but remained under the jurisdiction of the juvenile court, and (3) who violated juvenile court probation after becoming an adult.
A contrary interpretation  limiting the detention and commitment options of section 202, subdivision (e), and section 208.5 to wards who are minors when they are detained or committed by the juvenile court  not only would be inconsistent with the authority set forth in sections 726 and 727, but also would be inconsistent with the best interests of delinquent wards and the rehabilitative purpose of the statutory scheme. This is so because interpreting section 202, subdivision (e), and section 208.5 to apply only to wards who are minors at the time they are detained or committed would make a juvenile court reluctant to place a ward on probation when the ward is days or months shy of his or her 18th birthday, since the court would have no option to detain and punish the ward if he or she violated probation after becoming an adult. Lacking authority to hold the ward accountable for violating probation, the juvenile court would be more inclined to commit him or her to the California Youth Authority. Likewise, such an interpretation would not serve the statutory interest of protecting public safety because it would preclude a juvenile court from ordering the detention and later commitment of a ward who has violated probation after becoming an adult.
Accordingly, harmonizing sections 202, 208.5, 607, 726, and 727 together to effectuate the purpose of the law, give effect to each, and avoid absurd consequences that *509 the Legislature could not have intended, we conclude that section 202, subdivision (e), and section 208.5 apply to a ward of the juvenile court who violates juvenile court probation after becoming an adult.

B
As we have noted, section 208.5 provides that when a ward of the juvenile court "who is detained in or committed to a county institution established for the purpose of housing juveniles attains the age of 18 prior to or during the period of detention or confinement he or she may be allowed to come or remain in contact with those juveniles until the age of 19, at which time he or she, upon the recommendation of the probation officer, shall be delivered to the custody of the sheriff for the remainder of the time he or she remains in custody, unless the juvenile court orders continued detention in a juvenile facility...."
Appellant contends that section 208.5 "is not applicable to the pre-disposition detention here, because [he] was not housed in a juvenile institution when he turned 18...." However, he overlooks that the statute applies when a ward "attains the age of 18 prior to ... the period of detention or confinement...." (Emphasis added.) In such a circumstance, section 208.5 permits the now-adult ward to be detained in a juvenile facility. If the ward is 19 years of age, the statute allows the ward to be delivered to a local adult detention facility, unless the court orders continued detention in the juvenile facility.
Here, because appellant was 20 years of age when he was apprehended for an alleged probation violation, the probation officer recommended that appellant be detained in county jail pending further proceedings. The juvenile court judge who ruled on the motion (Judge Ann H. Rutherford) agreed, implicitly declining to exercise her statutory authority to order appellant's "continued detention in a juvenile facility." (§ 208.5.) The only flaw in the court's order is that section 208.5 requires a ward to be detained in "a county institution established for the purpose of housing juveniles" before he may be "delivered to the custody of the sheriff." In other words, the court should have ordered appellant to be detained in a juvenile facility and, upon recommendation of the probation office, immediately transferred to county jail. However, appellant cannot show that he was prejudiced by this failure to comply with the statutory scheme.
Appellant complains that he "was not advised of his right to petition the court for continued detention in a juvenile facility." But, again, he can demonstrate no prejudice because his attorney evidently was aware of this "right" since she argued at the detention hearing that it was inappropriate to detain appellant in an adult facility pending the probation revocation hearing. After observing that appellant should be detained "in the juvenile hall or adult detention facility, whichever is appropriate," the juvenile court ordered continuing detention in the county jail. There was no prejudicial error.

C
After the juvenile court (Judge Stephen D. Bradbury) found that appellant had violated terms of his probation, defense counsel cited two published opinions (In re Kenny A., supra, 79 Cal.App.4th 1, 93 Cal.Rptr.2d 678 (hereafter Kenny A.); In re Jose H. (2000) 77 Cal.App.4th 1090, 92 Cal.Rptr.2d 228 (hereafter Jose H.)) and argued they "prohibit the court from basically sentencing an adult to county jail on juvenile matters." The prosecutor countered that the decisions in Kenny A. and *510 Jose H. are distinguishable because they involved wards who were 18 years old, whereas appellant was 20 years old, and that pursuant to section 208.5, a ward who is 19 years of age or older can "be given commitment time and be ... moved to county jail."
Concluding that a period of confinement was an appropriate sanction for appellant's violation of probation, the juvenile court acknowledged that it could not "make a direct commitment to the county jail...." But the court noted that section 208.5 authorizes the probation officer to exercise discretion to, in the court's words, "remove [appellant] from juvenile hall to the county jail." Accordingly, the court ordered appellant to serve a specified period of confinement "in an authorized facility...."
Characterizing the order as a commitment directly to county jail, appellant contends "the disposition order was in excess of the juvenile court's jurisdiction, and must be reversed."
As we have explained in part A, ante, when an adult ward violates probation while still under the jurisdiction of the juvenile court, subdivision (e) of section 202 authorizes the court to punish the ward by committing him or her "to a local detention or treatment facility, such as a juvenile hall, camp, or ranch." (§ 202, (e)(4).)
The Sixth Appellate District has interpreted section 202, subdivision (e), to preclude the juvenile court from punishing an 18-year-old ward by committing him directly to a local adult detention facility. (Jose H., supra, 77 Cal.App.4th at pp. 1096-1100, 92 Cal.Rptr.2d 228.) This is so, the court reasoned, because a commitment to a local adult detention facility is not listed among the options specified in subdivision (e)(4) of section 202. (Id. at pp. 1097-1098, 92 Cal.Rptr.2d 228.) Characterizing section 208.5 as a statute "regulating the custodial segregation of adults and juveniles," Jose H. held that section 208.5 does not "purport to expand the authority of the juvenile court beyond the dispositional alternatives specified in section 202, subdivision (e)." (Id. at pp. 1097-1098, 92 Cal.Rptr.2d 228.)
Kenny A., another decision of the Sixth Appellate District, also dealt with a ward who was 18 years old. (Kenny A., supra, 79 Cal.App.4th at p. 4, 93 Cal.Rptr.2d 678.) Because of the ward's age, the probation office recommended that he be committed to the county jail. (Id. at p. 4, 93 Cal.Rptr.2d 678.) Apparently mindful of the holding in Jose H., the juvenile court committed the ward to juvenile hall for a period of 180 days, but added he "will then be committed to the county jail...." (Kenny A., supra, 79 Cal.App.4th at pp. 4-5, 93 Cal.Rptr.2d 678.) Reiterating its earlier ruling that a ward 18 years of age cannot be committed directly to the county jail, Kenny A. concluded the disposition was unauthorized since it was "for all practical purposes, a county jail commitment." (Id. at p. 8, 93 Cal.Rptr.2d 678.) The fact the juvenile court "did say that [the ward] was committed to juvenile hall" was of no moment because "[t]o accept this procedural subterfuge as proper would be to condone an unauthorized disposition by the juvenile court." (Ibid.)
Appellant claims the disposition order in his case "was no different from that overturned in Kenny A., in which the court ordered the [ward] committed to juvenile hall, but made clear from its comments that the minor was merely to report to juvenile hall and would immediately be remanded to serve his time in county jail." We are not persuaded.
While we agree with the Sixth Appellate District that a juvenile court cannot commit a ward over the age of 17 directly to *511 county jail, it does not follow that the court cannot commit a ward 19 years of age or older to a juvenile detention facility with the understanding that, because the probation officer so recommends, the ward will be delivered to the sheriff for confinement in county jail pursuant to section 208.5. Such a disposition is not a "procedural subterfuge" to "condone an unauthorized disposition by the juvenile court." (Kenny A., supra, 79 Cal.App.4th at p. 8, 93 Cal.Rptr.2d 678.) It is a legitimate application of the statutory scheme that allows the now-adult ward to be housed in a juvenile detention facility until the age of 19, at which time he or she must be delivered to a local adult facility unless the court orders continued detention in the juvenile facility. (§ 208.5.) When the court (1) commits a ward 19 years of age or older to a juvenile facility, (2) knows the probation office recommends that the ward be delivered to an adult detention facility, and (3) declines to exercise the court's discretion to order continued housing in the juvenile facility, the disposition is faithful to both section 202, subdivision (e)(4), and section 208.5.
Indeed, a contrary interpretation would generate an absurd result, inconsistent with the purpose of the statutory scheme to hold wards "accountable for their behavior" by imposing punishment "in conformity with the interests of public safety and protection." (§ 202, subd. (b).) As even the Sixth Appellate District has recognized, its interpretation of the statutory scheme creates a "dilemma [for] the juvenile court searching for an appropriate disposition for [a] ward [who is 18 years of age or older]." (Jose H., supra, 77 Cal.App.4th at p. 1099, 92 Cal.Rptr.2d 228.) The Sixth Appellate District notes that if the Legislature so chooses it can correct the flaw in the statutes, as that court sees it. (Ibid.) However, we respectfully respond that the flaw is not in the statutes but in the Sixth Appellate District's interpretation of them to preclude a juvenile court from confining such a ward in a juvenile facility knowing that, upon recommendation of the probation office, the ward will be delivered to the county jail pursuant to section 208.5.
Here, the juvenile court astutely recognized it could not commit appellant directly to county jail, but that it could order confinement in "an authorized facility," i.e., a juvenile facility, knowing the ward would be delivered by that facility to the county jail unless the court ordered otherwise. There was no error.

DISPOSITION
Having decided the issues on the merits because they are likely to recur, we dismiss the appeal as moot.
We concur: RAYE and MORRISON, JJ.
NOTES
[*]   Werdegar, J., did not participate therein. Kennard and Chin, JJ., dissented.
