Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
28
Task/Reflection-Get-source/Java/reflection-get-source.java
Normal file
28
Task/Reflection-Get-source/Java/reflection-get-source.java
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
public class ReflectionGetSource {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ReflectionGetSource().method1();
|
||||
|
||||
}
|
||||
|
||||
public ReflectionGetSource() {}
|
||||
|
||||
public void method1() {
|
||||
method2();
|
||||
}
|
||||
|
||||
public void method2() {
|
||||
method3();
|
||||
}
|
||||
|
||||
public void method3() {
|
||||
Throwable t = new Throwable();
|
||||
for ( StackTraceElement ste : t.getStackTrace() ) {
|
||||
System.out.printf("File Name = %s%n", ste.getFileName());
|
||||
System.out.printf("Class Name = %s%n", ste.getClassName());
|
||||
System.out.printf("Method Name = %s%n", ste.getMethodName());
|
||||
System.out.printf("Line number = %s%n%n", ste.getLineNumber());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue