Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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
Question ajoutée par Faten Almajaly
Date de publication: 2014/06/23
Utilisateur supprimé
par Utilisateur supprimé

XZ

Emad Mohammed said abdalla
par Emad Mohammed said abdalla , ERP & IT Software, operation general manager . , AL DOHA Company

the output will X Z

wahed mohammed abdul
par 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

Khalid Ahmed Budnar
par Khalid Ahmed Budnar , Manager IT Projects , Qatar Airways - HIA

xz

Utilisateur supprimé
par Utilisateur supprimé

Xz

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?