Results 1 to 3 of 3
  1. #1
    kskgupta is offline Member
    Join Date
    May 2010
    Rep Power

    Default reading values into variables using java

    i,m very new to java how read values into variables using java and i want to know about Exception handling and about threads

  2. #2
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Rep Power


    well I can recommend read sun tutorials first and get some books. Just google it

    i,m very new to java how read values into variables
    it is called initialize variables ;)

    int a=10; Something like that or String a="10";
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  3. #3
    somanayr is offline Member
    Join Date
    May 2010
    Rep Power


    Do you mean reading variables from the consol?

    First, you need to add to the header (very very top, even above public class):
    Java Code:
    import java.util.Scanner;
    then, in your main, add
    Java Code:
    Scanner input = new Scanner(;
    to read variable input from the consol, follow this example:
    Java Code:
    int a = input.nextInt()
    to change the type of thing to read use next() for strings and nextFloat() for floats (be sure to change the variable type as well!)

Similar Threads

  1. Replies: 1
    Last Post: 03-08-2010, 07:25 PM
  2. Replies: 3
    Last Post: 08-24-2009, 08:39 PM
  3. Help in reading values from html form in java
    By ichkoguy in forum Advanced Java
    Replies: 7
    Last Post: 03-16-2009, 08:45 AM
  4. [SOLVED] Debug: values not shown for variables
    By jwilley44 in forum Eclipse
    Replies: 7
    Last Post: 01-30-2009, 04:33 AM
  5. Replies: 2
    Last Post: 08-03-2007, 05:06 PM

Posting Permissions

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