File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes java programming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java programming" Watch "java programming" New topic

java programming

winny dhar

Joined: Nov 14, 2011
Posts: 13
friends if i want to print numbers 1 to 100 without using loops what logic would be applied in this??
using loops to i can make but without i am not getting ..
Srinivas Reddy Mudimala

Joined: Nov 17, 2011
Posts: 2
make use of label,break,continue and if keywords to get the output
Matthew Brown

Joined: Apr 06, 2010
Posts: 4543

Other than the obvious (100 separate print statements ), assuming this is an exercise it's probably looking for you to use a recursive method (i.e. a method that calls itself).
winny dhar

Joined: Nov 14, 2011
Posts: 13
thanku.. ya i got it using recursion..
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Make one method with you print statement and call it recursively it till a flag value is 100
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
Welcome to the Ranch
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

Matthew Brown wrote:Other than the obvious (100 separate print statements )

amateur...I can do it with one print statement.

I agree. Here's the link:
subject: java programming
It's not a secret anymore!