English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I feel kind of stupid asking this basic of a question but here it goes...

so i have an instance variable private int currentElement;
and it's changed many time through the program let's say to 0 then 1 then 2. Now I need to change the currentElement to "undefined" however when i try and declare it as null. Is this because it is a primitive type so I can't declare it as null after initializing the variable?

2007-01-26 16:23:48 · 1 answers · asked by michaelmgkdn 2 in Computers & Internet Programming & Design

1 answers

an object can be a null,
but a primitive can be zero

Convert currentElement to integer object
then you can do whatever you want.

2007-01-26 16:39:00 · answer #1 · answered by iyiogrenci 6 · 0 0

fedest.com, questions and answers