Set time between two if loops in java
Hi i want to set the time interval for few seconds between two if
conditions. In my coding first "if" condition executes, control will stop
3 seconds after that only second "if" condition will execute.I dont want
to use thread thread concept. I want some other option in java like
"Timer" class etc.I tried many times but cant find solution . Please give
solution for that
Thanks in advance
Here my code: package com.example;
public class TimeBetween {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int a=5;
int b=3;
int c;
if(a!=0&&b!=0)
{
c=a+b;
System.out.println("Addition:"+c);
}
if(a!=0&&b!=0)
{
c=a-b;
System.out.println("Subtraction:"+c);
}
}
}
No comments:
Post a Comment