• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception for number >= 0 and > 240

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a program that currently catches the NumberFormatException for the JTextField.getText() command when adding to a string variable. However, I'm trying to create an exception for any values less than or equal to 0 and greater than 240 before adding the converted Double values to an array. Any suggestions?
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tom Ross wrote:I created a program that currently catches the NumberFormatException for the JTextField.getText() command when adding to a string variable. However, I'm trying to create an exception for any values less than or equal to 0 and greater than 240 before adding the converted Double values to an array. Any suggestions?



You mean like this?


 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tom Ross wrote:However, I'm trying to create an exception for any values less than or equal to 0 and greater than 240 before adding the converted Double values to an array. Any suggestions?


why do you want to create an exception object there? are you going to throw ?

And Welcome to JavaRanch
 
Tom Ross
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I am looking to throw an exception if the value of the double is not high, equal to zero, or negative
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tom Ross wrote:Yes I am looking to throw an exception if the value of the double is not high, equal to zero, or negative



So are you still having trouble? If so, in what way did my previous post not answer your question?
reply
    Bookmark Topic Watch Topic
  • New Topic