The following code 'll return the number of lines in the file 'example.txt'
- if (!file.exists()){
- }
- if (file.isDirectory()){
- }
- int line = 0;
- try {
- while (ln.readLine() != null) {
- line++;
- }
- e.printStackTrace();
- }
- return line;
- }