compile error

Posted on 2005-04-16
Last Modified: 2010-03-31
hello, im getting a error and dont understand what it means. It says missing return statement, any ideas.
this is the code that i get the error on:
//Method: getFinalExam
      private static int getFinalExam() throws IOException
            int iReturn = -1;

            System.out.println("The Final exam is worth 100 total points");
            System.out.println("Please enter your fianl exam grade.");

            boolean bDone = false;
            while (!bDone)

            int finalExam = Integer.parseInt(Keyboard.readLine());
            if ((finalExam >= 0) && (finalExam <= 100))
                        bDone = true;
                        iReturn = finalExam;
                        System.out.println("Enter a score from 1 - 100");
            return iReturn;

Question by:scJohn
    LVL 9

    Accepted Solution

    return the iReturn outside of the while loop.
    As far as the compiler is concerned, !isDone may never be true, therefore may not return.
    LVL 9

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Title # Comments Views Activity
    VB Script 3 60
    Java virtual machine monitoring tools 3 30
    triangle challenge 4 35
    Modeling a class in java 5 22
    If you have upgraded to Java2 update 10 on a Microsoft Windows client, you may have discovered that your Java application does not work as it did before.  For example, the colors of your Java2D graphic may be all wrong for no apparent reason. Aft…
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now