Java Stuck in For Loop -


I am working on the Java project and for some reason I do not understand that my code is the last < / Strong> for loop

  Float Profit = 0; Float damage = 0; (Int i = this.currentLine- 14; i & lt; this.currentLine; i ++) {stockline PD = (stockline) for this.rows.get (i); Profit + = pd.getGain (); Loss + = pd.getLoss (); Println (i); } System.out.println ("Why It Is not Printed");   

If I wanted to remove this three line, then it works as expected:

  stockline PD = (stockline) this.rows.get (i ); Profit + = pd.getGain (); Loss + = pd.getLoss ();   

this.rows is an ArrayList with a large number of objects (stocklines). About 200 elements.

Does Java have a limit on the number of arrivate object?

The code has not been compiled and executed successfully;

Any help will be highly appreciated.

Ahmed

Edit:

Quick Reply Thanks for everyone. Below is the current class. The only part of the project is reading a file-line-by-line and calling the file () method below.

The method getGain () and getLoss () just returns a float.

This ReadStock or this pre> package nyc.amin; Import java.util.ArrayList; Public Class ReadStock ReadFileInterface applies {Private Ent currentLine = 0; Private Arrestist rows = new Arrivits (); @ Override public zero file (string line) {if (this.currentLine == 0) {this.currentLine ++; Return; } String [] row = line split (","); Stockline current date = new stockline (); CurrentDay.setDate (line [0]); currentDay.setTime (line [1]); CurrentDay.setOpen (line [2]); CurrentDay.setHigh (line [3]); CurrentDay.setLow (line [4]); CurrentDay.setClose (line [5]); CurrentDay.setVolume (line [6]); If (this. CurrentLine> = 2) {stockline is last = (stockline) this.rows.get (this.rows.size () - 1); CurrentDay.setGainOrLoss (current day .getClose () - last day .getClose ()); If (this.currentLine == 15) {Float Profit = 0; Float damage = 0; (Int i = this.currentLine- 14; i & lt; this.currentLine; i ++) {stockline PD = (stockline) for this.rows.get (i); Profit + = pd.getGain (); Loss + = pd.getLoss (); Println (i); } System.out.println ("Why It Is not Printed"); }} This.rows.add (currentDay); This.currentLine ++; } @ Override Public Zero End () {//System.out.println(----------------- "); //System.out.println (this.rows.size ());}}

I'm very stupid when the loop goes in the present, T is present in ArrayList, it does not throw and error or exception.

This line needs to change only:

 For  (int i = this.currentLine - 14; i & lt; this .currentLine; i ++) For {  

TO

  (int i = this.currentLine - 14; i & lt; this.currentLine - 1; I ++) {  

Thanks to all those who answered.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -