File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Quesiton regarding Java Property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Quesiton regarding Java Property" Watch "Quesiton regarding Java Property" New topic

Quesiton regarding Java Property

Aditya Sirohi
Ranch Hand

Joined: Jan 05, 2010
Posts: 93


I have a properties file with a value:-


I my code i do:-
String notiExp = getProperty("IZ_NOTIFICATION_EXP") and then do
Integer.parseInt(notiExp); to use it as an integer value.

My question is what if some one passes the value of the property as IZ_NOTIFICATION_EXP="30", i.e a String. How do i validate if the user passed a String and if user passed a String i can do certain operations?

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

Ask yourself this question. Is the data stored in the properties file text? Can it be stored as an int or any other non text type?

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Quesiton regarding Java Property
It's not a secret anymore!