| | |
help with watch program
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 25
Reputation:
Solved Threads: 0
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
The highlighted statement gives an error.
pls help me with the logic of displaying it on the same line.
thanks
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();
}
}pls help me with the logic of displaying it on the same line.
thanks
Let me guess "un-catch exception". Put that section in try/catch exception and catch InterruptedException (API)
Last edited by peter_budo; Dec 5th, 2008 at 2:08 pm. Reason: add link
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Aug 2007
Posts: 63
Reputation:
Solved Threads: 0
first of all, what is the value of variable (s) here in the program, it is assumed here as it is zero , is it the value that you want it or not
secondly the looping will be infinite because value of variable (a) and value of variable (b) is always same , therefore check it again to make the loop finite
hope it helps
thanks
secondly the looping will be infinite because value of variable (a) and value of variable (b) is always same , therefore check it again to make the loop finite
hope it helps
thanks
Hello, shubhang.
You've asked:
Here is a few articles about positioning cursor in console application:
http://mindprod.com/jgloss/console.html
http://en.allexperts.com/q/Java-1046...or-console.htm
http://www.rgagnon.com/javadetails/java-0469.html
Hope it can help
You've asked:
•
•
•
•
pls help me with the logic of displaying it on the same line.
http://mindprod.com/jgloss/console.html
http://en.allexperts.com/q/Java-1046...or-console.htm
http://www.rgagnon.com/javadetails/java-0469.html
Hope it can help
Last edited by Antenka; Dec 6th, 2008 at 3:26 pm.
So what if you can see the darkest side of me?
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
![]() |
Similar Threads
- simple c++ program (any help would be greatly appreciated) (C++)
- Receiving user input to direct program (C++)
- Error loading C:\WINDOWS\Downloaded Program Files\bridge.dll (Viruses, Spyware and other Nasties)
- In Desperate Need of Help with hijack this log file; computer full of spyware (Viruses, Spyware and other Nasties)
- IE6 has been constantly hijacked by .... (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: NetBeans and MYSQL
- Next Thread: java ping
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design draw eclipse encryption error event exception fractal game givemetehcodez graphics gui html ide if_statement image inheritance input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile monitoring netbeans newbie nullpointerexception open-source oracle print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql static stop string swing testautomation threads time tree ui unicode validation windows






