Jump to content

Error in java... int cannot be dereferenced


Lepper

Recommended Posts

First of all... sorry for posting here... but there is no section of Java language in this forum... but i know someone here can help me :)I got the error "int cannot be dereferenced" inside a for... this is the code

<%	if(dsc != null) {	  boolean pintO = false;	  for(int j = 0; j < dsc.length; j++){if(dsc[j].getDetalleEvaluacion().getContenidoGlobal().getCodContenido().equals(detalleEvaluacion.getContenidoGlobal().getCodContenido())&& dsc[j].getDetalleEvaluacion().getContenidoGlobal().getUnidadGlobal().getCodUnidad().equals(detalleEvaluacion.getContenidoGlobal().getUnidadGlobal().getCodUnidad())&& dsc[j].getDetalleEvaluacion().getEvaluacion().getAsignatura().getCursoColegio().getCodCursoColegio().equals(detalleEvaluacion.getEvaluacion().getAsignatura().getCursoColegio().getCodCursoColegio())&& dsc[j].getDetalleEvaluacion().getEvaluacion().getAsignatura().getAsignatura().getCodAsignatura().equals(detalleEvaluacion.getEvaluacion().getAsignatura().getAsignatura().getCodAsignatura())&& dsc[j].getDetalleEvaluacion().getEvaluacion().getCodEvaluacion().equals(detalleEvaluacion.getEvaluacion().getCodEvaluacion())&& dsc[j].getCalificacion().getAlumno().getCodAlumno().equals(alumno.getCodAlumno())) {%><input type="text" onChange="soloNumeros(this);" title="Ingrese acá la puntuación obtenida en este contenido de la evaluación" class="input4" value="<%=dsc[j].getPuntajeContenidoCalificacion()%>"><%  pintO = true;  break; //si lo encontro se sale de la iteracion  }  }  if(!pintO){%>       <input type="text" onChange="soloNumeros(this);" title="Ingrese acá la puntuación obtenida en este contenido de la evaluación" class="input4"><%}}%>

yeah... I know is a really large if... but there has to be that way :)the question is that this: I DON'T USE "j" like an object... because error "int cannot be dereferenced" appears when someone tries to use a primitive type like an object... "j" it's just an index to iterate over the array "dsc"... so... WHY IS THIS HAPPENING?Thanks to all... I know you can help me... please help me!!THANKS!!

Link to comment
Share on other sites

If any of those methods in your (amazingly large :)) if statement return an int rather than an object, it would most likely be the cause of your error. You might want to check those methods to see what the return types are.EDIT: I don't understand the language in which this is written, but these look like likely candidates for the cause of the error:.getCodUnidad().getCodAsignatura().getCodContenido().getCodAlumno()Only because I'm assuming "Cod Alumno" translates to something like "Alumni Code".

Link to comment
Share on other sites

If any of those methods in your (amazingly large :blink:) if statement return an int rather than an object, it would most likely be the cause of your error. You might want to check those methods to see what the return types are.EDIT: I don't understand the language in which this is written, but these look like likely candidates for the cause of the error:.getCodUnidad().getCodAsignatura().getCodContenido().getCodAlumno()Only because I'm assuming "Cod Alumno" translates to something like "Alumni Code".
THANK YOU VERY MUCH!!! Your answer was absolutely correct!! I thought that every getCodSomething() returns a String, but there was a method (.getCodEvaluacion()... the was not listed in your list :) ) that returns an int value... and there was the problem, because I used the method .equals in this primitive type! what a blasfemy!! Thank you very much jesh! I was confused because the error message that the compiler sends me, said that the problem was in "j" (the index of the "for" statement)... so... that teachs me that I cannot trust in the compiler messages :)Ah! this code is written in spanish... my country language :blink:Well... I repeat... THANK YOU VERY MUCH!! AAAH!!! I'M SO HAPPY!! THANK YOUUUU!! :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...