@@LogicFirstTamil package OOPS; class Box{ int length; int breath; int height; Box(int l,int b,int h){ length=l; breath=b; height=h; } boolean isEqual(Box b){//call by reference of object created if(length==b.length && breath==b.breath && height==b.height) return true; return false; } Box doublebox(){//Returning Objects Box temp = new Box(2*length,2*breath,2*height); return temp; /*temp.length=2*this.length; temp.breath=2*breath; temp.height=2*height;*/ } } public class PassingRefDemo { static void increment(int a) {//call by value a++;//method created in with in main method does not work } public static void main(String[] args) { int a=10; increment(a); System.out.println(a); Box b1=new Box(5,12,13); System.out.println(b1.length); Box b2=new Box(12,12,13); b1.isEqual(b2); System.out.println(b1.isEqual(b2)); //Box b3=b1.doubleBox();//returning object Example Box b3=b1.doublebox(); System.out.println(b3.length);//returning object Example } }
Mam tks ..pls continue Ur teaching work hats off U mam..daily i.am watching Ur videos only..
இனிமை
line 42..Bit confusing mam, U can use instead Box b2 = new Box(b1);
Akka .Net videos podungaa
have planned for python and then ds. adhuke romba time aagum. will add .net afterwards. u can learn from kudvenkat channel. its very good.
@@LogicFirstTamil neenga TH-camr ah irunthalum, innoru channel sugest panringa ur great..
Mam this can also be done by Copy Constructor...
Is there any other use of this...
mam what is covariant return type?
Mam enaku error varudhu
Java.lang.NoSuchMethodError nnu varudhu mam enna pandradhu nu sollu ga plzz
paste ur code
@@LogicFirstTamil package OOPS;
class Box{
int length;
int breath;
int height;
Box(int l,int b,int h){
length=l;
breath=b;
height=h;
}
boolean isEqual(Box b){//call by reference of object created
if(length==b.length && breath==b.breath && height==b.height)
return true;
return false;
}
Box doublebox(){//Returning Objects
Box temp = new Box(2*length,2*breath,2*height);
return temp;
/*temp.length=2*this.length;
temp.breath=2*breath;
temp.height=2*height;*/
}
}
public class PassingRefDemo {
static void increment(int a) {//call by value
a++;//method created in with in main method does not work
}
public static void main(String[] args) {
int a=10;
increment(a);
System.out.println(a);
Box b1=new Box(5,12,13);
System.out.println(b1.length);
Box b2=new Box(12,12,13);
b1.isEqual(b2);
System.out.println(b1.isEqual(b2));
//Box b3=b1.doubleBox();//returning object Example
Box b3=b1.doublebox();
System.out.println(b3.length);//returning object Example
}
}
@@activebgm6864 which line u get err. u need to give complete details
@@LogicFirstTamilmam andha static variable and static method andha thuniyaal adhhlayaum idha error dha varudhu
Mam idhula passingRefDemo dhana class idhula epdi box class ah copy panninga...enakku error varudhae...class kulla class podalama?
yes, but it should be static
❤️