
558 N.W.2d 35 (1997)
251 Neb. 404
Eugene J. HYNES, Appellee,
v.
Kelly Michael HOGAN, Appellant.
No. S-95-1337.
Supreme Court of Nebraska.
January 3, 1997.
*37 Kelly Michael Hogan, pro se.
Edward D. Steenburg, Ogallala, for appellee.
WHITE, C.J., and CAPORALE, WRIGHT, CONNOLLY, and GERRARD, JJ.
CAPORALE, Justice.

I. STATEMENT OF CASE
This action arises on the complaint of the plaintiff-appellee, Eugene J. Hynes, charging that the defendant-appellant, Kelly Michael Hogan, who had been elected to the office of county attorney for Garden County, engaged in official misconduct by continuing, in violation of statute, to reside in Keith County after his election, and praying that Hogan be removed from office and that the office be declared vacant. The district court granted Hynes' prayer, whereupon Hogan sought review by the Nebraska Court of Appeals, asserting that the district court erred in, among other things, overruling his demurrer. Finding merit in that claim, the Court of Appeals reversed the judgment of the district court and remanded the cause for further proceedings. Hynes v. Hogan, 4 Neb.App. 866, 553 N.W.2d 162 (1996). Hynes thereafter successfully petitioned this court for further review, and we now in part affirm and in part reverse the judgment of the Court of Appeals.

II. SCOPE OF REVIEW
The dispositive issues present questions of law, in connection with which we have an obligation to reach our own conclusions independent of those reached by the lower courts. See, McLaughlin v. Hellbusch, 251 Neb. 389, 557 N.W.2d 657 (1997); Olson v. SID No. 177, 251 Neb. 380, 557 N.W.2d 651 (1997); State v. Kennedy, 251 Neb. 337, 557 N.W.2d 33 (1996).


*38 III. FACTS
The transcript from the district court contains an uncertified copy of Hogan's "REQUEST FOR TRANSCRIPT," which directs the clerk thereof to prepare a transcript containing: "All pleadings filed in this action, including Defendant and Appellant's Demurrer... Journal Entry dated June 7, 1995 [and] Journal Entry dated November 7, 1995." The clerk has certified that the transcript contains "a full, true and correct copy of those items outlined by index as per Request for Transcript ... as the same appears [sic] from the records of [that] Court," and lists in the index, among other things, "Complaint for Removal" and "Defendant's Demurrer." Thus, although the clerk inexpiably failed to stamp the document denominated "DEFENDANT'S DEMURRER" and bearing Hogan's signature block as received and failed to attest to when it was filed, she has nonetheless warranted that at some point the pleading was filed in these proceedings. Hogan represented at oral argument that the pleading was filed before trial was held.
Hynes' complaint alleges that at the time Hogan was elected as county attorney of Garden County on November 8,1994, he was a resident of Keith County and has continued to reside in that county in violation of statute; concludes that as a result, Hogan is guilty of official misconduct; and prays that Hogan be removed from the office of Garden County Attorney.
Hogan's so-called demurrer is a discursive pleading which in essence denies that Hogan engaged in official misconduct and asserts that Hynes' complaint fails to state a cause of action, in that it does not plead in compliance with the statutory prerequisites to the instituting of an action in quo warranto.
Although neither the June nor the November journal entry makes any reference to Hogan's demurrer, the transcript contains no other pleading by which Hogan addresses the allegations of Hynes' complaint; the June journal entry is the document by which the district court ruled, as described in part I, and the November journal entry overruled Hogan's motion for new trial.

IV. ANALYSIS
At the pertinent time, the relevant portion of Neb.Rev.Stat. § 23-1201.01 (Supp. 1993) provided that a county attorney "need not be a resident of the county" when filing for election, but "shall reside in the county in which he or she holds office." Relying on that provision, Hynes brought this proceeding under the provisions of Neb.Rev.Stat. §§ 23-2001 through 23-2009 (Reissue 1991), which provide for the removal of county officers through judicial proceedings. Under the terms of § 23-2001, county officers "may be charged, tried, and removed from office... for ... official misconduct as defined in section 28-924," and § 23-2002 empowers "[a]ny person" to make the charge. Neb. Rev.Stat. § 28-924 (Reissue 1995) declares that a "public servant commits official misconduct if he knowingly violates any statute or lawfully adopted rule or regulation relating to his official duties."
For purposes of our analysis, we assume, but do not decide, that Hogan was not residing in Garden County and turn our attention to whether the charge made in the complaint states a cause of action under the provisions of §§ 23-2001 through 23-2009. That is, Does a charge that after his election Hogan failed to move to Garden County, in violation of § 23-1201.01, constitute a charge of official misconduct?
The question is resolved by determining whether Hogan's failure to reside in Garden County relates to his official duties, for under the language of § 28-924, the failure cannot be official misconduct unless it so relates. There is no claim or evidence that Hogan's failure to reside in Garden County renders him incapable of performing, or any claim or evidence that he did not perform, the myriad obligations imposed upon a county attorney by law, such as: the preparation, signing, verification, and filing of complaints and the prosecution and defending of certain suits, as required by Neb.Rev.Stat. § 23-1201 (Reissue 1991); the appearance before grand juries, as permitted by Neb.Rev.Stat. § 29-1408 (Reissue 1995); the certification of certain causes of death, as required by Neb.Rev. Stat. § 71-605 (Cum.Supp.1994); and the enforcement of tax collections, as required by *39 Neb.Rev.Stat. § 77-2030 (Reissue 1990). It therefore cannot be said that Hogan has engaged in official misconduct. As a consequence, Hogan's objection that the complaint fails to state a cause of action under §§ 23-2001 through 23-2009 is meritorious.
In order to ascertain the consequences of that determination, we next turn our attention to the procedural posture of this case. Section 23-2003 provides that the "proceedings shall be as nearly like those in other actions as the nature of the case admits, excepting where otherwise provided in sections 23-2001 to 23-2009."
Section 23-2006 provides:
No answer or other pleading after the complaint is necessary, but the defendant may move to reject the complaint upon any ground rendering such motion proper; and he may answer if he desires, and if he answers the accuser may reply or not. But if there be an answer and reply, the provisions of section 23-2003 relating to pleadings in the action shall apply.
Notwithstanding the unsupported and unfortunate obiter dictum in Plock v. Crossroads Joint Venture, 239 Neb. 211, 475 N.W.2d 105 (1991), that an answer alleging that a petition fails to state a cause of action is in fact a demurrer, Hogan's pleading was not a demurrer, even though it was denominated as such. Rather, for the reasons which follow, it was an answer which included the objection that the complaint failed to state a cause of action. That being so, we need not, and do not, determine whether a demurrer is a proper pleading in proceedings under the foregoing statutes.
We begin our analysis of the nature of Hogan's pleading by recalling that Neb. Rev.Stat. § 25-806 (Reissue 1995) provides, in relevant part, that a "defendant may demur to the petition only when it appears on its face" that, among other things, "the petition does not state facts sufficient to constitute a cause of action." Neb.Rev.Stat. § 25-808 (Reissue 1995) declares:
When any of the defects enumerated in section 25-806 do not appear upon the face of the petition, the objection may be taken by answer, and if no objection be taken either by demurrer or answer, the defendant shall be deemed to have waived the same, except ... that the petition does not state facts sufficient to constitute a cause of action.
Accordingly, we have held that the failure to demur does not waive the objection that a cause of action has not been stated and that such objection can be raised at any time. See, Contois Motor Co. v. Saltz, 198 Neb. 455, 253 N.W.2d 290 (1977); Gordon v. City of Omaha, 77 Neb. 556, 110 N.W. 313 (1906).
We have also held that a demurrer goes only to those defects which appear on the face of the petition, and in ruling on a demurrer, evidence cannot be considered. Pappas v. Sommer, 240 Neb. 609, 483 N.W.2d 146 (1992). Inasmuch as Hogan's pleading denied that he had engaged in official misconduct, an allegation which could be adjudicated only upon the receipt and consideration of evidence, the pleading was necessarily not a demurrer, but an answer. Indeed, the fact that the district court received and considered evidence on the merits suggests that it considered the pleading to be an answer. Its silence on the objection to the adequacy of the complaint further suggests that it found the objection to be groundless.
The difference between a demurrer and an answer containing an objection to the adequacy of the complaint is not an insignificant one. Where a demurrer is sustained, the cause of action continues to pend until dismissed, Carlson v. Metz, 248 Neb. 139, 532 N.W.2d 631 (1995); thus, the rule is that upon the sustainment of a demurrer, the party against whom it is directed must be granted leave to amend, unless it is clear that no reasonable possibility exists that the amendment will correct the defect, see Baltensperger v. Wellensiek, 250 Neb. 938, 554 N.W.2d 137 (1996). At that point, no party has sustained the burden and expense of trial, and no party has received an adjudication. The situation is obviously quite different when there has been a trial; in that circumstance, the operative principle is that one who has sustained the burden and expense of trial and has succeeded in securing a judgment on the facts in issue has a right *40 to keep the benefit of the judgment unless there is prejudicial error in the proceedings in which the judgment was secured. See German v. Swanson, 250 Neb. 690, 553 N.W.2d 724 (1996).
We thus hold that when no demurrer has been filed and a matter proceeds to trial on the merits under an objection in an answer that a cause of action has not been stated, and it is determined that the objection should have been sustained, the party against whom the objection was directed shall not be granted leave to amend. Accordingly, Hynes is not now entitled to leave to amend his complaint in an effort to state a cause of action under §§ 23-2001 through 23-2009. To the extent the obiter dictum in Plock v. Crossroads Joint Venture, 239 Neb. 211, 475 N.W.2d 105 (1991), may be read to suggest otherwise, it is overruled.
However, that does not end our review, for although the requirement of § 23-1201.01 that Hogan reside in Garden County does not relate to his official duties, it nonetheless constitutes a qualification for holding the office of county attorney of that county. See State v. Jones, 202 Neb. 488, 275 N.W.2d 851 (1979) (suggesting residence is qualification for county commissioner). One's qualification to hold office may be challenged by an action in quo warranto. Neb. Rev.Stat. § 25-21,121 (Reissue 1995) (information may be filed against any person unlawfully holding or exercising any public office); Jones, supra (quo warranto action testing right to hold office). See, also, Shear v. County Board of Commissioners, 187 Neb. 849, 195 N.W.2d 151 (1972) (quo warranto proper remedy to test right to hold office).
But even if Hynes' complaint states a cause of action in quo warranto, a determination we need not and do not make, he has failed to establish such a case. If for no other reason, this is so because the record does not establish that he met one of the requirements set by Neb.Rev.Stat. § 25-21,122 (Reissue 1995) for such an action. That statute requires one filing an information in quo warranto to file "with such information in the office of the clerk of the district court a bond ... the amount of which bond shall be not less than five hundred dollars and be fixed by ... the clerk," conditioned that the action shall be prosecuted "without delay" and that the elector "shall pay the costs of such suit including a reasonable attorney fee to the person against whom such information is filed should the action be unsuccessful." See State ex rel. Brogan v. Boehner, 174 Neb. 689,119 N.W.2d 147 (1963) (distinguishing between quo warranto actions brought under § 25-21,121 and those brought under Neb.Rev.Stat. § 25-21,146 (Reissue 1995) by one claiming right to office, holding bond not required in actions brought under second statute, and noting bond requirement in actions brought under first statute).

V. JUDGMENT
Accordingly, we affirm that part of the judgment of the Court of Appeals which reverses the judgment of the district court, but reverse that part of the judgment which remands the matter to the district court for further proceedings.
AFFIRMED IN PART, AND IN PART REVERSED.
