I want to store the line number of classes and function of java program written in a textarea. I was following this link posted by me Storing the line number of all the occurrence of particular character in javascript with the logic that the classes and the function starts with "{" but it will not work if loop or condition statement comes in a program.
Here is a textarea content:
public class Largest {
public static void main(String[] args) {
double[] numArray = { 23.4, -34.5, 50.0, 33.5, 55.5, 43.7, 5.7, -66.5 };
double largest = numArray[0];
for (double num: numArray) {
if(largest < num)
largest = num;
}
System.out.format("Largest element = %.2f", largest);
}
}
The output: Array content is... 1 3 4 7
. I want the array output only 1,3
.
Please suggest me approach of how to identify and find the line number of classes and function.