Results 1 to 2 of 2

Thread: Hello

  1. #1
    chandu is offline Member
    Join Date
    Jun 2007
    Posts
    1
    Rep Power
    0

    Default Hello

    hello to every one

    Iam new to this forum and iam learning java now

    I have a doubt in Java basics

    Why ever variable like integer,float etc.that we enter at command line (or)taking variable from keyboard (using InputStramReader and BufferedReader) is taken in string data type in main method.In C/C++ we never do this type of conversion.

    Please anyone clear my doubt

  2. #2
    levent Guest

    Default

    ...taken in string data type in main method
    That is the standard way for main method, check signatures of main methods in C. It is same with Java.

    that we enter at command line (or)taking variable from keyboard (using InputStramReader and BufferedReader)
    Because every other variable type is convertable from String! You can also read bytes from files if you want. Reading files line by line or byte by byte is a common practice in C world too as far as i know. I think that is the most generic way of doing this. If you think about this and possible input types/ input files, i guess you will see the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •