I'm reading an excel file that contains some numeric value using Apache POI and I want to convert then to a string when I type cell.setCellType(Cell.CELL_TYPE_STRING); It shows like this (http://imgur.com/a/hZvUl) and I get an NullPointerException
can anyone help me?
The strikethrough text is most likely how your IDE warns you that you are using deprecated methods - methods that are from an old version of an API, that you are not supposed to use anymore.
Can you show us more of your code than just that one line? Otherwise it's really hard to help you and to find out why you get a NullPointerException.
In general, one of the reasons you can get a NullPointerException is when you try to call a method on a variable that is null. If it happens in the line in your image, then most likely the variable cell is null.
Jesper de Jong wrote:The strikethrough text is most likely how your IDE warns you that you are using deprecated methods - methods that are from an old version of an API, that you are not supposed to use anymore.
Usually you're right, but I happen to know this one. In the current version of POI, they deprecated the int cell types and everything that's related to it. However, the enum replacement will not be added until POI 4. That's right - they deprecated it in advance without providing the alternative. They should have just waited with deprecating until the replacement was in place.
So Qubayel, in this case, you can ignore this deprecation warning.