Skip to main content

All Questions

Tagged with
0 votes
4 answers
118 views

from recursion to iteration

I have recursive function: public static int fRek(int n) { if (n <= 0) return 1; else if (n == 1) return 2; else return 3 * fRek(n-2)-...
user3096218's user avatar
0 votes
2 answers
724 views

Printing Specific Pattern using for Loop in Java

i have to print specific pattern using Java for loop . Input will be 4 characters eg. a, b , c, d now what i have to print is aaaa aaab aaac aaad aaba abbb ...
Sikander's user avatar
  • 2,835
1 vote
3 answers
2k views

How to iterate over an array returned by a function in Java

What's the best way to iterate over an array returned by a function? Example: for (String s : collectMyStrings()){ System.out.println(s); } Is collectMyStrings() called in each iteration, or does ...
kadrian's user avatar
  • 5,009