You should really state what language you are using. I have produced your method in C#, and should be easily translatable in to any other language.
static void RotateRight<T>(T[] arr)
{
T temp = arr[arr.Length - 1];
for (int i = arr.Length - 1; i >= 0; i--)
{
if (i == 0)
arr[i] = temp;
else
arr[i] = arr[i - 1];
}
}
Answer:
I've seen these a lot. What happens when you click on them tho?
Explanation:
You could hit tab or you could hit the space bar
Answer:
public Clock (Clock c)
{
hours = c.hours;
isTicking = c.isTicking;
}
Explanation:
Since the name of the Java class is called Clock, the constructor must have that same name, so we start by declaring the constructor as public Clock (Clock c) with a clock parameter. Within the contructor body we assign the variables hours and isTicking to the respective member feilds