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

  • SEARCH
  • Home
  • 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 5943305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:22:35+00:00 2026-05-22T16:22:35+00:00

As I know if method throws an exception Java compiler forces the caller of

  • 0

As I know if method throws an exception Java compiler forces the caller of that method to catch that exception.

I see that parseInt throws NumberFormatException :

public static int parseInt(String s) throws NumberFormatException {
    return parseInt(s,10);

So why I can call it wthout catching the exception :

String str = "5";
int n = Integer.parseInt(str);
  • 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-05-22T16:22:35+00:00Added an answer on May 22, 2026 at 4:22 pm

    Because NumberFormatException extends RuntimeException – Runtime Exceptions are considered to be ‘unchecked’, See the Javadoc of RuntimeException:

    RuntimeException is the superclass of
    those exceptions that can be thrown
    during the normal operation of the
    Java Virtual Machine.

    A method is not required to declare in
    its throws clause any subclasses of
    RuntimeException that might be thrown
    during the execution of the method but
    not caught.

    Here is an article from the Java tutorial explaining how this feature is meant and why it exists

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

Sidebar

Related Questions

I'm getting a NumberFormatException on the Integer.parseInt() method. I know this exception is produced
When I have a method like this: public static void foo(String param) throws IOException
Does anyone know the official method for submitting feedback on C# 4.0 so that
Assume we have a trivial Java program that consists of just one class: public
In Java, you explicitly define what exceptions are thrown using the throws keyword. That
I know that what's messing up is my checkIfEdu method. Everything else is fine
The following code: public class TestInnerClass { public static void main(String[] args) throws IOException
I'm used to Atlas where the preferred (from what I know) method is to
I know the method below isn't meant to work with any Entity, and its
Does anyone know a method to programmatically close the CD tray on Windows 2000

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.