Article View: comp.lang.java.programmer
Article #628Why, oh, why??
From: Frederik Hansen
Date: Tue, 10 Oct 2000 00:00
Date: Tue, 10 Oct 2000 00:00
49 lines
1699 bytes
1699 bytes
Hi
Why does this not work?? When printing the StackTrace it prints an
Exception, and not a RuntimeException as I hoped?
(This is a test setup, proberly not making any sense)
--- File : MethodOverload.java
public class MethodOverload
{
public static void main(String[] args)
{
try
{
throw new RuntimeException("e");
}
catch (Exception e)
{
try
{
throw TestObject.method(e);
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
}
}
--- File : TestObject.java
public class TestObject
{
public static Exception method(Exception test)
{
return new Exception("1");
}
public static Exception method(RuntimeException test)
{
return new RuntimeException("Test");
}
}
Regards,
Frederik Hansen
Technical Details
Message-ID:
<39E35A22.2748A7F6@roirex.dk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f9a23,58c4f0a3e7100464,start X-Google-Attributes: gidf9a23,public X-Google-Thread: 10a146,58c4f0a3e7100464,start X-Google-Attributes: gid10a146,public From: Frederik Hansen <frederik@roirex.dk> Subject: Why, oh, why?? Date: 2000/10/10 Message-ID: <39E35A22.2748A7F6@roirex.dk> X-Deja-AN: 679813647 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: Department of Written Abuse <abuse@news.inet.tele.dk> X-Trace: news.inet.tele.dk 971201088 16292 195.249.35.206 Organization: Tele Danmark Internet Cyberspace Launchpad Mime-Version: 1.0 Newsgroups: comp.lang.java.programmer,dk.edb.programmering.java