Java tutorial
//package com.java2s; public class Main { public static int _LINE_() { StackTraceElement traceElement = ((new Exception()).getStackTrace())[1]; return traceElement.getLineNumber(); } }