- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are number format exceptions in Java?
This Exception happens once you associated convert a string variable in an incorrect format to a whole number (numeric format) that's not compatible with one another.
Example
public class Test { public static void main(String[] args) { int data = Integer.parseInt("hello"); } }
Output
Exception in thread "main" java.lang.NumberFormatException: For input string: "hello" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at a6.dateAndTime.Test.main(Test.java:5)
- Related Articles
- What are chained exceptions in Java?
- What are checked exceptions in Java?
- What are unchecked exceptions in Java?
- What are custom exceptions in Java?
- What are SimpleDateFormat Format Codes in Java?
- Format floating point number in Java
- What are the custom exceptions in C#?
- What are user-defined exceptions in C#?
- What are the rules to follow while using exceptions in java lambda expressions?
- Precision on a number format in Java
- Custom exceptions in Java
- What are the various important exceptions in Selenium?
- Built-in Exceptions in Java
- What is meant by re-throwing exceptions in Java?
- Are the instances of Exception checked or unchecked exceptions in java?

Advertisements