我需要定义一个数字的最后一位,将其赋值给value.在此之后,返回最后一位数字.
我的代码片段无法正常工作......
码:
public int lastDigit(int number) {
String temp = Integer.toString(number);
int[] guess = new int[temp.length()];
int last = guess[temp.length() - 1];
return last;
}
Run Code Online (Sandbox Code Playgroud)
题: