×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: William Chalifoux
Added: Mar 15, 2021 7:34 PM
Views: 4779
Tags: no tags
  1.    public static int getLineNumber() {//line number outputer
  2.     return Thread.currentThread().getStackTrace()[2].getLineNumber();
  3. }
  4.  
  5.  
  6. //insert this where you want the line number to be outputted
  7. System.out.println("Line number "+Useful.getLineNumber());