Learning I/O

I am trying to write a practice code that asks for the user to input numbers, it complies fine but when it runs and a number is put in it terminates:
Import java.io.*;
class  first {
      public static void main (String [] args )throws IOException{
BufferedReader in = new BufferedReader(
    new InputStreamReader(System.in));
       int Length,Width, Area;
         System.out.print ("enter Length:");
                  Length = Integer.parseInt (stdin.readLine());
         System.out.print("Enter Width:" );
                  Width = Integer.parseInt (stdin.readLine());
         System.out.println ("Area =" + (Length*Width));
}

}

What am doing wrong?

danmattAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hilitCommented:
danmatt,
several comments (relevant only if this is the exact code):
1. You didn't define stdin (called it "in")

2. should be import and not Import (no capital letter)

I ran it with these 2 corrections and it ran okay.
Good luck!

Hilit
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
danmattAuthor Commented:
We fixed those errors.  Those were just typos when we sent to you.  It compiles fine, but doesn't run.  As soon as you enter the length you get:
Interrupted!
Process completed with exit code -1.

See below corrected code:

import java.io.*;
class  first {
      public static void main (String [] args ) throws IOException {
                BufferedReader stdin = new BufferedReader
                   (new InputStreamReader(System.in));
       int Length, Width, Area;
         System.out.print ("enter Length:");
                  Length = Integer.parseInt (stdin.readLine());
         System.out.print("Enter Width:" );
                  Width = Integer.parseInt (stdin.readLine());
         System.out.println ("Area =" + (Length*Width));
   }
   }

0
hilitCommented:
so? did it help or not?

Hilit
0
danmattAuthor Commented:
It fixed the problem in the listed code.  However, the main problem was we were using "Textpad" as our editor.  When running the application, the preference box was checked "capture output".  Once this box was unchecked, it worked.  We tried to do it in dos, and there the problem was we compiled in text pad and ran in dos.  When we compiled in dos edit program and ran it worked fine.  So bottom line we had several problems.
0
hilitCommented:
Again, the simplest solution turns out to be the best...
Regards,
Hilit
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.