Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8440447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:17:59+00:00 2026-06-10T08:17:59+00:00

I was studying the Exception chapter in java and wondering if it does any

  • 0

I was studying the Exception chapter in java and wondering if it does any good to put some throws UncheckedException after a method signature. I can see that with checked exceptions that kind of a statement is necessary to compile the code and with try, catch and finally all exceptions can be handled. But my question is what difference if at all does it make to add a throws UncheckedException after a method signature?
for example, to compile the following code with a File object, you need to have a checked exception:

void main(String args[])throws IOException{
    File f=new File("c:\\java\\xyz.txt");
}

But what effect such a statement has in the following code:

public static int method1(String str)throws NumberFormatException{
    int i=Integer.parseInt(str);
    return i;
}

thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:18:00+00:00Added an answer on June 10, 2026 at 8:18 am

    Adding a throws clause with an UncheckedException is only for documentation purposes, it has no functional effect.
    However, this definitely makes sense in certain situations. The usual reason to do this is if you expect someone else to use your class, and you want to make it clear that your method might throw a certain Exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While studying Java tutorials, Reflection and Late Binding have confused me. In some tutorials,
Studying compilers course, I am left wondering why use registers at all. It is
Studying MS Exam 70-536 .Net Foundation I've got to Chapter 11 Application Security and
Just studying the C style of Jon Bentley's Programming Pearls and was wondering if
In studying actionscript 3's graphics class, I've come across the undocumented drawRoundRectComplex() method. It's
After studying TCP/UDP difference all week, I just can't decide which to use. I
I'm studying about windows and DLL stuffs and I have some question about it.
While studying the Collection API, we find that some methods ( add , remove
I'm studying for Java Programmer Certification (SCJP) exam. A question about exceptions, when handle
I am studying to use Apache Mahout, and get the following message after running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.