SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Ankit Garg wrote:Shruti please Quote Your Sources when you post a question...
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Prasad Kharkar wrote:
I am a good boy
Marriage Made in Heaven
http://www.youtube.com/user/RohitWaliaWedsSonia
K&B book,SelfTest Question number 10 and 12,Flow Control chapter wrote:Hello everyone,
Can anyone explain me the flow of the following 2 programs??
3. public class Circles {
4. public static void main(String[] args) {
5. int[] ia = {1,3,5,7,9};
6. for(int x : ia) {
7. for(int j = 0; j < 3; j++) {
8. if(x > 4 && x < 8) continue;
9. System.out.print(" " + x);
10. if(j == 1) break;
11. continue;
12. }
13. continue;
14. }
15. }
16. }
Ans : D. 1 1 3 3 9 9 (HOW???)
3. public class Wind {
4. public static void main(String[] args) {
5. foreach:
6. for(int j=0; j<5; j++) {
7. for(int k=0; k< 3; k++) {
8. System.out.print(" " + j);
9. if(j==3 && k==1) break foreach;
10. if(j==0 || j==2) break;
11. }
12. }
13. }
14. }
Ans: C. 0 1 1 1 2 3 3 (HOW???)
SCJP6.0,My blog Ranchers from Delhi
SCJP6.0,My blog Ranchers from Delhi
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|