Friday, 30 August 2013

Setting null value to integer

Setting null value to integer

How can i set null to integer variable initially instead of "0". I know
already by default all int value is "0". I used string.valueOf() method
etc. I get number format exception. Please give one solution for that.
Thanks in advance
Here code
public class IntegerDemo {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String id="";
System.out.println(""+Integer.parseInt(id));
}
}

No comments:

Post a Comment