Do you want to print the line number of the code currently in execution in a Java program. You can use this:
System.out.println ("The line number is " + new Exception().getStackTrace()[0].getLineNumber());
Monday, March 5, 2012
![](https://1.bp.blogspot.com/-ZOdpphDQl-U/WWw49Og-H5I/AAAAAAAAA1I/Cub7AcvWjdI786uCnmgjIWM9R6teug_uwCK4BGAYYCw/s1600/3589758-designstyle-soccer-m%2B-%2BCopy.png)
Print current code line number
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment