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 7688091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:50:35+00:00 2026-05-31T19:50:35+00:00

if(str.contains(final)) { id = Integer.parseInt(str.substring(18, str.length() – 6)); } System.out.println(id); This line of code

  • 0
if(str.contains("final"))
{
    id = Integer.parseInt(str.substring(18, str.length() - 6));    
}
System.out.println(id);

This line of code id = Integer.parseInt(str.substring(18, str.length() - 6));
I got the output as “final year” but it throws an illegalnumberformat exception
For input string: ” final Year”

at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at Product.main(Product.java:47)

How to solve this issue?

I have a text file which has both string and int in it like

final year
93
93
90
91.
In this input given,I need to find the “final year” string and display the count of the number’s below it without repetition.How can I do that

  • 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-31T19:50:36+00:00Added an answer on May 31, 2026 at 7:50 pm

    Make sure what you pass into Integer.parseInt() is an int or a String.
    If it is a String, make sure it is in numeric format (ie: “2” is okay but “two” is not)

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

Sidebar

Related Questions

Have got an NSString *str = @12345.6789 and want to find out if there
i have the following code: foreach (var str in usedCSS) { if (CSS.Contains(str)) Response.Write(str);
I have an xml file that contains its element like <ab:test>Str</ab:test> When I am
When compiling this: char *str = [[NSString stringWithFormat:@%i days and %i hours, days, hours]
string str contains somewhere within it http://www.example.com/ followed by 2 digits and 7 random
A string variable str contains the following somewhere inside it: se\> I'm trying to
How to do the following using Regex String Str=11111111; if(Str.Contains(0)) MessageBox.Show(Not matching); else MessageBox.Show(Matching);
When we have a string that contains space characters: var str = ' A
I have inherited code which contains debugging macros. #define DEBUG_LEVEL_NONE 0 #define DEBUG_LEVEL_ONE 1
I've got a script using a captcha class like this <?php @session_start(); require str_replace('\\','/',dirname(__FILE__))

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.