0

Arraylist change places of dogs Java

Hello, My task is to make my own method to swap dogs in A Arraylist. In Java ) The method is supposed to take in the indexes of the two dogs as parameters. I Should it look like this? : if i want to change/swap places of the dogs like i collections method but with own coding How can I Do that? CSN I use If-? public void swapDogs(int a,int b) { } Return ; }

8th Jan 2023, 12:51 AM
Melissa 123
Melissa 123 - avatar
1 Respuesta
+ 2
Post your attempt here.. Hint: int temp = a; a = b; b = temp; // swapped a, b
8th Jan 2023, 8:14 AM
Jayakrishna 🇮🇳