Re: why am I getting this error "varible temp1 might not have been initialized"
- From: "sandie" <amanda772007@xxxxxxxxx>
- Date: 25 Mar 2006 13:24:12 -0800
I did the following and the program compiled but when exectute, it sits
and wait for input.
float temp2=0;
Scanner keyboard2 = new Scanner(System.in);
System.out.println("Enter a float value with 2 decimal position for
a temperature.");
if (keyboard2.hasNextFloat())
temp2 = keyboard2.nextFloat();
String strScale2 ="C";
System.out.println("Enter one character for degree scale (C or
F).");
if (keyboard2.hasNext())
strScale2 = keyboard2.next();
char scale2 = (strScale2.toUpperCase()).charAt(0);
When run, the program sits and wait for input.
.
- Follow-Ups:
- References:
- why am I getting this error "varible temp1 might not have been initialized"
- From: sandie
- Re: why am I getting this error "varible temp1 might not have been initialized"
- From: Roedy Green
- Re: why am I getting this error "varible temp1 might not have been initialized"
- From: sandie
- Re: why am I getting this error "varible temp1 might not have been initialized"
- From: Roedy Green
- Re: why am I getting this error "varible temp1 might not have been initialized"
- From: sandie
- why am I getting this error "varible temp1 might not have been initialized"
- Prev by Date: Re: why am I getting this error "varible temp1 might not have been initialized"
- Next by Date: How to skip when there is no input for Scanner object
- Previous by thread: Re: why am I getting this error "varible temp1 might not have been initialized"
- Next by thread: Re: why am I getting this error "varible temp1 might not have been initialized"
- Index(es):