/**
*
* @author YNZ
*/
public class PrintOneToNWithoutLoop {
public static void main(String[] args) {
printN(1);
System.out.println("");
}
public static void printN(int n) {
if (n <= 100) {
System.out.print(" " + n);
n++;
printN(n);
}
}
}
Sunday, 6 May 2018
How to print 1 to 100 without using loop
recursion call works the same as a loop.
Subscribe to:
Post Comments (Atom)
Can Jackson Deserialize Java Time ZonedDateTime
Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...
-
Could not extract response: no suitable HttpMessageConverter found for response type [class dk.enettet.evu.core.model.Address] and content ...
-
First time met this hibernate exception. I think this issue should due to one to one relationship. One driver has one car; one car has on...
-
A large object refers to the entity property that is modified by @Lob. It may be persisted in several records. However, in database manage...
No comments:
Post a Comment