What are the rules for counting lines of code in a Java program?
My first guess was every ";", but that won't work for the for loops, which would have 2 lines in themselves...
Printable View
What are the rules for counting lines of code in a Java program?
My first guess was every ";", but that won't work for the for loops, which would have 2 lines in themselves...
At first glance I would say, load the file into an array, one line per element.
Loop through it and subtract 1 for each line that starts with comment character. Subtract 1 for each blank line. I'm not savvy with java syntax so you'll have to make up the rest yourself. There have been line counting threads on VBF before and they discussed the use of Regex patterns, might be worth a look.