AF
Home
Tag
Submit Notes
Ask Anything
Login
Subscribe Us
A
ny
F
orum
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.
Follow @anyforumin
corejava-programming: How to print the numbers from 0 to 100 without using for loop or recursion?
Please give me java source code to print the numbers from 0 to 100 without using for loop or recursion.
corejava x 353
programming x 169
Posted On :
2014-09-04 01:46:45.0
Saksham Kumar
734
339
39909
5
Answers
There are many solutions available but all have either for loop or recursion. Following is the java source code to print the numbers without using for loop or recursion manually.
import java.util.*;
public class TimerUser
{
public static void main(String[] args)
{
new Timer().schedule(
new TimerTask()
{
int count;
public void run()
{
System.out.println(count+1);
if (++count >= 100)
System.exit(0);
}
},
new Date(), 1);
}
}
Posted On :
2014-09-04 01:58:48
Satisfied :
1 Yes
1 No
Rishi Kumar
523
1882
50045
Reply This Thread
5
Post Answer
Please Login First to Post Answer:
Login
Answer:
anyforum.in