Results 1 to 4 of 4
- 03-06-2013, 12:18 PM #1
Member
- Join Date
- Mar 2013
- Posts
- 1
- Rep Power
- 0
Java Exception Handling regarding Constructor
Hi Everybody
In the below code ...If i remove constructor Test11(int i) or change it to Test11(int i) throws Exception then it compile and run.Can anybody clarify why compiler ask to include throws clause in constructor Test11(int i)...though I am explicitly calling Test11() by .... Test11 t = new Test11();
public class Test11 extends A
{
Test11()throws Exception{
System.out.println("Test10 Class");
}
Test11(int i)
{
System.out.println("Test10 Classdfdfdfdff");
}
public static void main(String args[]) throws Exception{
Test11 t = new Test11();
}
}
class A
{
A() throws Exception{
System.out.println("A Class");
}
}
Why does it do so when it does not explicitly or implicity get the Exception
Thanks
DeepakDev
- 03-06-2013, 12:23 PM #2
Re: Java Exception Handling regarding Constructor
Moved from a staff-only section.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-06-2013, 12:25 PM #3
Re: Java Exception Handling regarding Constructor
Cross posted and didn't have the courtesy to reply to the second response there before asking the same question here:
Java Exception Handling regarding Constructor (Java in General forum at JavaRanch)
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-06-2013, 12:31 PM #4
Re: Java Exception Handling regarding Constructor
Thanks for the heads up, Darryl.
ignoreList++Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
Similar Threads
-
exception handling
By Elaforestis in forum New To JavaReplies: 1Last Post: 01-29-2013, 04:37 AM -
Exception Handling
By Bicentric in forum New To JavaReplies: 1Last Post: 07-22-2012, 09:37 PM -
Exception handling
By ExX in forum New To JavaReplies: 6Last Post: 03-12-2012, 11:48 AM -
Interface ,abstract and exception handling in Java
By shazeb in forum New To JavaReplies: 2Last Post: 03-14-2011, 11:34 AM -
exception handling in java
By koushikG in forum New To JavaReplies: 1Last Post: 12-04-2010, 12:22 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks