1. public void foo( boolean a, boolean b) { if( a ) { System.out.println("A"); / Line 5 / } else if(a && b) / Line 7 / { System.out.println( "A && B"); } else / Line 11 / { if ( !b ) { System.out.println( "notB") ; } else { System.out.println( "ELSE" ) ; } } }





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    Option C is correct. The output is "ELSE". Only when a is false do the output lines after 11 get some chance of executing. Option A is wrong. The output is "A". When a is true, irrespective of the value of b, only the line 5 output will be executed. The condition at line 7 will never be evaluated (when a is true it will always be trapped by the line 12 condition) therefore the output will never be "A && B". Option B is wrong. The output is "A". When a is true, irrespective of the value of b, only the line 5 output will be executed. Option D is wrong. The output is "notB".
Show Similar Question And Answers
QA->Null and void....
QA->The program that monitors users activity on internet and transmit that information in background to somewhere else is termed as....
QA->Article lays down that there shall be a Public Service Commission for the Union and a Public Service Commission for each states:....
QA->Article lays down that there shall be a Public Service Commission for the Union and a Public Service Commission for each states:....
QA->A process in which a public relations representative sends out press releases to various media outlets to promote a company change, a new product or a new service is known as....
MCQ->public void foo( boolean a, boolean b) { if( a ) { System.out.println("A"); / Line 5 / } else if(a && b) / Line 7 / { System.out.println( "A && B"); } else / Line 11 / { if ( !b ) { System.out.println( "notB") ; } else { System.out.println( "ELSE" ) ; } } }....
MCQ->What will be the output of the program? public class Foo { Foo() { System.out.print("foo"); } class Bar { Bar() { System.out.print("bar"); } public void go() { System.out.print("hi"); } } / class Bar ends / public static void main (String [] args) { Foo f = new Foo(); f.makeBar(); } void makeBar() { (new Bar() {}).go(); } }/ class Foo ends /....
MCQ->What will be the output of the program? public class Test { public static void main(String args[]) { class Foo { public int i = 3; } Object o = (Object)new Foo(); Foo foo = (Foo)o; System.out.println("i = " + foo.i); } }....
MCQ->What will be the output of the program? public class Test { public static void main (String [] args) { final Foo f = new Foo(); Thread t = new Thread(new Runnable() { public void run() { f.doStuff(); } }); Thread g = new Thread() { public void run() { f.doStuff(); } }; t.start(); g.start(); } } class Foo { int x = 5; public void doStuff() { if (x < 10) { // nothing to do try { wait(); } catch(InterruptedException ex) { } } else { System.out.println("x is " + x++); if (x >= 10) { notify(); } } } }....
MCQ->What will be the output of the program? public class Delta { static boolean foo(char c) { System.out.print(c); return true; } public static void main( String[] argv ) { int i = 0; for (foo('A'); foo('B') && (i < 2); foo('C')) { i++; foo('D'); } } }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution