i have two classes:parentbox and chiildbox
class parentbox
{
int width;
int height;
int length;
}
class chiildbox
{
public static void main(String args[])
{
parentbox babybox1= new parentbox();
parentbox babybox2=babybox1;
babybox1.height=10;
babybox1.length=19;
babybox1.width=2;
int vol;
System.out.println("the vol of babybox1 is"+(babybox1.height*babybox1.length*babybox1.width));
//parentbox babybox2=babybox1;
System.out.println("Now babybox2 contains:");
System.out.println("babybox2.height=",+babybox2.height);
System.out.println("babybox2.length=",+babybox2.length);
System.out.println("babybox2.width=",+babybox2.width);
}
}
here i am trying to assign babybox1 values to babybox2.
i am getting 3 errors:
chiildbox.java:14: cannot find symbol
symbol : method println(java.lang.String,int)
location: class java.io.PrintStream
System.out.println("babybox2.height=",+babybox2.height);
^
chiildbox.java:15: cannot find symbol
symbol : method println(java.lang.String,int)
location: class java.io.PrintStream
System.out.println("babybox2.length=",+babybox2.length);
^
chiildbox.java:16: cannot find symbol
symbol : method println(java.lang.String,int)
location: class java.io.PrintStream
System.out.println("babybox2.width=",+babybox2.width);