Please help me with a simple watch program.
In the program,I have to display on the same line.
i have written the following code which is not working.
pls look into it
class watch
{
private int h,m,s,a=0,b=0;
public void calc()
{
for(;a==b;s++)
{
if(s%60==1)
{
m++;
}
if(m%60==1)
{
h++;
}
System.out.println(h+" : "+m+" : "+s);
Thread.getThread().sleep(1000);
}
}
public static void main(String args[])
{
watch w1=new watch();
w1.calc();
}
}
The highlighted statement gives an error.
pls help me with the logic of displaying it on the same line.
thanks