0
Why code is not give output ?
public class Box { private int l,b,h; public Box() { l=8;b=4;h=6; } public Box(int L,int B,int H){ l=L;b=B;h=H; } public static void main(String[] args) { Box b1= new Box (); Box b2= new Box (20,4,6); } }
6 Answers
+ 3
You need to use the object reference.
These are some examples-
System.out.println(b1.l);
System.out.println(b2.h);
+ 2
samrat kundu where are you printing it to see the output?
0
I'm beginners so I don't know properly how print this code.
System.out.println(" the output is"+l " " +b " " +h);
Is that right ?
0
Write the print statement to print output
0
Thank you đ Muhammad Bilal