Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8241757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:56:09+00:00 2026-06-07T20:56:09+00:00

I tried submitting this and an error pops up saying ** END OF FILE

  • 0

I tried submitting this and an error pops up saying ** END OF FILE detected on input — EXIT **.

I cant figure out what this means, just to be clear I am trying to set up a system so that data is input on a loop unless the value is 0. Thanks.

This is my code:

class Main
{
    public static void main( String args[] )
    {
        int SN = 1;
        while ( SN != 0)
        {
            System.out.print("#SN : " );
            SN = BIO.getInt();
            System.out.print("#CW : " );
            int CW = BIO.getInt();
            System.out.print("#EX : " );
            int EX = BIO.getInt();
            double Mark = CW + EX;
            System.out.printf("SN= " + SN + "EX= " + EX + "CW= " + CW + "Mark= " + "%6.1f", (double) Mark / 2      );
        }
    }
}

This is the BIO code:

class BIO
{
  private static final int EOF  = -1;
  private static final int NONE = -2;
  private static int nextChar = NONE;
  private static boolean EOFdetected = false;

  public static String getLineBASE()
  {
    String line = "";                                 // Line read 
    int    ch;                                        // Read ch 

    try
    {
      ch = System.in.read();                          // No next char 

      if ( ch == EOF ) 
      {
        System.out.println("**** END OF FILE " + 
                           "detected on input -- EXIT ****" );
        System.exit(-1);
      }
      while( ch != '\n'  )                            // Read loop 
      {
        if ( ch == EOF )
        {
          EOFdetected = true;
          return line;                                //  exit 
        }
        line = line + (char) ch;                      //  form line 
        ch = System.in.read();                        //  next ch 
      }
      return line;                                    // return line 
    }
    catch( IOException exp )                          // Problem 
    {
      System.exit(-1);                                // Exit ** 
    }
    return "";                                        // Blank line 
  }

 public static String getLine()
  {
    String line = getLineBASE();                      // Read line 
    //System.out.println( line ); 
    return line;
  }


  public static String getString()
  {
    String line = getLine();                          // Read line 
    return line.trim();
  }

  public static double getDouble()
  {
    String res = getLine();                           // Read line 
    double value = 0.0;                               // 
    try
    {
      value = Double.parseDouble( res.trim() );       // Convert 
    }
    catch ( NumberFormatException ex )                // Problem 
    {                                                 //  ignore 
    }
    return value;                                     // return 
  }

  public static int getInt()
  {
    String res = getLine();                           // Read line 
    int value = 0;                                    // 
    try
    {
      value = Integer.parseInt( res.trim() );         // Convert 
    }
    catch ( NumberFormatException ex )                // Problem 
    {                                                 //  ignore 
    }
    return value;                                     // return 
  }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:56:10+00:00Added an answer on June 7, 2026 at 8:56 pm
     try
    {
      ch = System.in.read();  //reads from keyboard.
    
      if ( ch == EOF ) 
      {
        System.out.println("**** END OF FILE " + 
                           "detected on input -- EXIT ****" );
        System.exit(-1);
      }
    }
    

    This snippet reads in input from the keyboard. If you want to read stuff from a file (Which I assume you are, since there is an EOF) look up the Scanner class. If this is not what you wanted, my apologies, I am only making assumptions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
I tried submitting my application but was told that the file cannot contain any
Tried to search for this online and didn't get very far, so I'm asking
I keep getting this error: Invalid Signature - This error occurs when you have
i have a form thats inside a iframe with a input type file with
I'm having trouble submitting an ajax request. I've tried to set it up pretty
I have a fancybox that loads a form that collects user input. In this
I have a form with dynamically created input fields - upon submitting it I
I tried searching and found out that someone has written a multipart form uploader.
You guys have helped me out so much this week it has been awesome.Hopefully

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.