[Solved] Why is program give 12 instead of 11 | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

[Solved] Why is program give 12 instead of 11

This program output is 12 why? Someone help out public class Cal { int a= 5; int b=6; public static void main(String[] args) { Cal aa= new Cal(); Cal bb= new Cal(); int z= aa.b + bb.b; System.out.println(z); } }

17th Jul 2019, 7:35 AM
Dprincebh
Dprincebh - avatar
2 Respuestas
+ 1
You get the b properties of both aa and bb, therefore the answer is 6 + 6 = 12
17th Jul 2019, 7:43 AM
Airree
Airree - avatar
0
Ooh thanks.
17th Jul 2019, 7:45 AM
Dprincebh
Dprincebh - avatar