0

Eh guys I wanted to know how to think the logic if a program is given to us?

Like in reverse a string, find characters in string programs, how do we know we need to use for loops and wat kinda checks should b made in for loop?? I know all concepts in Java except tis logics. Pls help me out frnz

24th Jan 2017, 6:06 PM
Ishu Pradeep
Ishu Pradeep - avatar
1 Antwort
+ 3
You doesn't quite seem to know all the logic if you can't figure this out, a pseudo code would go something like this. String[] fruits = new String[] { "Orange", "Apple", "Pear", "Strawberry" }; for (String fruit : fruits) { // fruit is an element of the `fruits` array. } The logic of for vs foreach is basically the same the only difference can be the performance of the iteration, traditionally people will say foreach is a little faster.
24th Jan 2017, 6:18 PM
Alex
Alex - avatar