i,m very new to java how read values into variables using java and i want to know about Exception handling and about threads
Printable View
i,m very new to java how read values into variables using java and i want to know about Exception handling and about threads
well I can recommend read sun tutorials first and get some books. Just google it
it is called initialize variables ;)Quote:
i,m very new to java how read values into variables
int a=10; Something like that or String a="10";
Do you mean reading variables from the consol?
First, you need to add to the header (very very top, even above public class):then, in your main, addCode:import java.util.Scanner;
to read variable input from the consol, follow this example:Code:Scanner input = new Scanner(System.in);
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!)Code:int a = input.nextInt()