例如,在某些编译错误期间,我可以访问发生错误的一些内置源代码(可能是main中的周长错误).如何手动访问这些相同的源代码?我主要对BigInteger类感兴趣.
比方说,我想将整个代码块输入一个命令:
int k = 0;
for (k = 0; k < 50; k++)
{
sprintf(buf, "M LR 10 -10\n"); //We put the string "M L 10" into the string buffer.
write(sock, buf, strlen(buf)); //We send the buffer into the socket.
memset(buf, 0, 80); //Clear the buffer, set buffer to value 0.
read(sock, buf, 80); //Read from the socket to get the results.
int lme, rme;
sprintf(buf, "S MELR\n"); //sensor command to find ME values
write(sock, buf, strlen(buf)); //sends the buffer …Run Code Online (Sandbox Code Playgroud) 这看起来很简单,但我得到了错误 "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at reverse.main(reverse.java:28)"
我最初从用户那里获取输入来编写数组,然后我想向后打印数组.我知道还有其他方法可以做到这一点,但我主要想知道为什么这不起作用.逐行完成它是有道理的吗?
PS.如果这不是问题,有没有更好的方法呢?
import java.util.Scanner;
public class reverse {
/**
* @param args
*/
public static void main(String[] args) {
System.out.printf("Enter the number of values in array: ");
Scanner scanner = new Scanner(System.in);
int n;
n = scanner.nextInt();
double[] a1 = new double[n];
int i;
System.out.printf("Enter the value in the array: ");
for (i = 0; i < n; i++){
Scanner scanner2 = new Scanner(System.in);
a1[i] = scanner2.nextInt();
}
double j;
double …Run Code Online (Sandbox Code Playgroud)