I want to understand what is clone()
method's benifit and when i should use it, why sometimes when i give the value of a variable to another variable the other variable links to the first variable, i mean when you make change to one of them the other's value automaticlly changes to this value which you changes although some times it doesn't happens.
OK now i show some examples:-
When initialising a RectF variable in
Android Java
language into another RectF variable it happens, (e.g.) :-static RectF var1; //initialise it static void someVoid(){ RectF var2 = var1; var2.set(...); //now when i changed var2 also the var1 changed }
but when initialising an
Integer
variable to another integer variable it won't happens, (e.g.) :-static int azhy = 1000; static void someVoid(){ int hello = azhy; hello++; //now when i change the hello variable azhy variable stays constantly }
i searched somewhere but i didn't found a result so if you can give me some description i will thankyou.