473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

A little bit about exception concept .... plz help me out....

dmjpro
2,476 2GB
here is my code like this ...

void test() throws Exception
{
//My code
}

if i call this method .....

obj_ref.test()

if the caller does not specify any code .. like throws Exception or

try
{
}catch(){}


in this case does compiler report any error like ... unreported excepiotn

if not why ???

if does ..... then also why????

i think u got my point .......

plz help me out ...

thanxxxx in advance
Mar 15 '07 #1
5 1187
Ganon11
3,652 Expert 2GB
I don't think there will be an Unreported Exception error, but if the Exception is generated, then your program will terminate because of an Unhandled Exception. I'm not 100% sure, though.
Mar 15 '07 #2
r035198x
13,262 8TB
here is my code like this ...

void test() throws Exception
{
//My code
}

if i call this method .....

obj_ref.test()

if the caller does not specify any code .. like throws Exception or

try
{
}catch(){}

in this case does compiler report any error like ... unreported excepiotn

if not why ???

if does ..... then also why????

i think u got my point .......

plz help me out ...

thanxxxx in advance
Put it on a compiler and see what happens. Try to explain your results first then you can ask if you have any doubt.
Mar 15 '07 #3
dmjpro
2,476 2GB
if i write IOException instead of Exception then what happens ......

is the term checked and unchecked exceptions come here in this context.....

plz expplain me in details these two terms....

thanxxxxx
Mar 16 '07 #4
r035198x
13,262 8TB
if i write IOException instead of Exception then what happens ......

is the term checked and unchecked exceptions come here in this context.....

plz expplain me in details these two terms....

thanxxxxx
Try these things on the compiler first dj, I will only try to explain when I'm satisfied you have tried it yourself.
Mar 16 '07 #5
dmjpro
2,476 2GB
i tried it myself and come to a conclusion like this .....


if a method specifies .... throws any exception

void test() throws any type of class inherited from Exception
{
}

then if i call test then it should be handled anyway or the caller method should report .....
the thrown exception may be checked or unchecked .. that does not any matter

if the code of test does not throw that exception ... only then
checked or unchecked comes up

m i right ....

any additional info is most welcome ...

thanxxxx
Mar 16 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robbie Hatley | last post by:
I've been playing with "auto_ptr" and the "Resource Acquisition Is Initialization" concept. On page 199 of Lippman's book "Effective C++" he says "All active local class objects of a function are...
12
by: Subhransu Sekhar Sahoo | last post by:
Hi All, I have a doubt in the implementation of C++ try catch exception handling procedure. Whenever there is a through, the execution has to go to the point of catch. Now, if the catch block...
17
by: cashdeskmac | last post by:
Nice and simple one for you all... Is there a time to use Catch(Exception) rather than creating an instance of the Exception, as in Catch(Exception ex)?
132
by: Zorro | last post by:
The simplicity of stack unraveling of C++ is not without defective consequences. The following article points to C++ examples showing the defects. An engineer aware of defects can avoid...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.