Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
java printStackTrace()
Name: jerryhz Date: February 18, 2009 at 14:52:26 Pacific OS: Windows 2000 CPU/Ram: 2G Subcategory: Java
Comment:
In java, we can call printStackTrace() method from exception object, such as:
Exception ex = new Exception(); ex.printStackTrace();
I remembered I used to call printStackTrace() from system.out.... I cannot remmber now. How can I print call hirerachy if I don't use exception object?
Name: klint Date: February 19, 2009 at 07:38:40 Pacific
Reply:
I can't think of any way of doing it without using an Exception object (or at least a Throwable, from which Exception is derived) but here's one way to print a stack trace:
for (StackTraceElement e : new Throwable().getStackTrace())
System.out.println(e);
0
Response Number 2
Name: jerryhz Date: February 19, 2009 at 09:06:35 Pacific
Reply:
Thanks for your reply. I have recalled another way of doing this:
Thread.dumpStack();
0
Response Number 3
Name: klint Date: February 19, 2009 at 09:18:01 Pacific
Summary: Ok, Im working on a program which needs to read a text file like so : 0000000000 0011110000 0011110000 0010010000 0000000000 0100001000 0010010000 0001100000 0000000000 0000000000 and put the numbers...
Summary: can any one help me with this code I have a problem in calculating average waiting time [code] /* fcfs.txt ******* 20 05 05 0*******************//* sjfnp.txt *******7 04 21 44 5********************/ ...
Summary: Folks: I am confused by Object Serialization in Java. Please take a look at the following code: import java.io.*; import java.util.*; public class Serialization { public static void main(String[] ar...