Karim Timer
Karim Timer

Reputation: 45

Javap -l does not show me my local variable table

For some reason, Command prompt isn't providing me with a local variable table, even though I am using the -l option. Any suggestion/points?

Image of what command prompt outputs for me.

Edit, here is the code for SumSqrt class:

public class SumSqrt {

/** Calculates the sum of the square roots of the elements of an array.
 * @param a the array
 * @return  Sum (i = 0 to a.length-1) Math.sqrt(a[i])
 */

public static double sumSqrt(double[] a) {
    double sum = 0.0;
    for(int i = 0; i<a.length; i++) {
        sum = sum + Math.sqrt(a[i]);
    }
    return sum;
}

public static void main(String[] args) {
    double[] array =  {2,10,30,44,9};

    System.out.println(sumSqrt(array));
}

}

Upvotes: 1

Views: 412

Answers (1)

Use the command

javac -g SumSqrt.java

After that use

javap -l SumSqrt.class

To store this output to file

javap -l SumSqrt.class > SumSqrt.txt

Upvotes: 1

Related Questions