int numx;
What i want to know is how do i enter other numbers such as ones with decimals and the such?!?How do i enter numbers into my java code?!?
Check out this link.
Basically what this is trying to say but I don't think quite works is
int a = 1; //integer
long b = 372036854775808L;
float c = 1.5f;
double d = 1.5d;
Obviously from previous examples you do not have to specifically identify the type of your input constants but it makes the program tidier and more compete.
Have fun.How do i enter numbers into my java code?!?
double mynum = 0.9832432;
or
float mynum = 0.6823432;
Both of the above allow decimal numbers, double is the more accepted standard but has a slightly higher memory overhead (Takes larger numbers)
Java is a great language to learn programming, feel free to contact me for more information, info@noirenex.com
As stated coding the line as
Double num
will work, to save you time, save it as a global Variable eg.
double num=0;
for(i=0;i%26lt;=4;i=i+1)
{
System.out.println(';what is your favorite number';)
num=kb.nextDouble ();
}
the forloop is not what im trying to tell you, its that if you put you int after you public static void main, and before what ever you will have the program do, itll save you a lot of time
No comments:
Post a Comment