Which would be the best way to write the same code in Java?:
Array.Resize(ref DCamposGraficoOperaciones[index].DatosMeses, 12);
I have this code in C# and I have to put it on in Java. Thanks so much. I have a method called resizeDatosMeses in Java to resize the array but when I try to do it in this way:
DCamposGraficoOperaciones[index].getDatosMeses()=resizeDatosMeses(DCamposGraficoOperaciones[index].getDatosMeses(), 12)
I have a mistake which is: The left-hand side of an assignment must be a variable, please could you advice me?
Thanks so much
I suspect you want:
You can’t assign to the result of a method call, which is what you were trying to do before.
I would strongly encourage you to break this line into two separate statements – and also start following Java naming conventions, which would prohibit
DCamposGraficoOperacionesas a variable name.Also, it’s not clear why you’re resizing an array to start with, but in both .NET and Java you may well be better off using a higher-level abstraction, e.g.
List<T>in .NET orArrayList<T>in Java.