ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What will be the output of the program (in jdk1.6 or above)?

public class BoolTest { public static void main(String [] args) { Boolean b1 = new Boolean("false"); boolean b2; b2 = b1.booleanValue(); if (!b2) { b2 = true; System.out.print("x "); } if (b1 & b2) /* Line13 */ { System.out.print("y "); } System.out.println("z"); } }

user-image
تم إضافة السؤال من قبل Faten Almajaly
تاريخ النشر: 2014/06/23
Emad Mohammed said abdalla
من قبل Emad Mohammed said abdalla , ERP & IT Software, operation general manager . , AL DOHA Company

the output will X Z

wahed mohammed abdul
من قبل wahed mohammed abdul , SAP Security Consultant , Accenture Solutions Pvt ltd

if(!b2) means If(!false)=> if(True) => print x 

now, b1=false, b2=true 

line13: if(b1 &b2) => if(false & true) => false , so it skips if condition

print z .

 Output:  xz

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟