Solved

Is there something like __LINE__ and __FILE__ in Java ?

Posted on 1998-07-28
1
682 Views
Last Modified: 2012-06-21
Is there anything in JAVA that is comparable to the __LINE__ and __FILE__ from C/C++ ?
thanks in advance!
0
Comment
Question by:jefftk99
1 Comment
 
LVL 4

Accepted Solution

by:
evijay earned 50 total points
ID: 1228771
You have to write a function which does the following -


Exception e = new Exception("dummy");
e.printStackTrace( a_print_stream);

here, a_print_stream is a PrintStream generated from a array of bytes or a custom print stream. The stack trace is sent to the print stream which you have to convert to chars, then, parse the function to get to the appropriate calling function details and print them

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now