java - Unreachable code error with no return -
i have program working on , started getting unreachable code errors @ return in columns() method. tried line , won't unreachable code. line "return obj" line can't reached. code below:
public class display { public static void main(string[] args){ int x,y; for(int = 1; < 5; a++){ system.out.print(a + "\t"); } system.out.println(); for(int = 0; < 10; i++){ y = i; x = 1; for(int z = 0; z < 4; z++) { system.out.print(x*y + "\t"); x++; } system.out.println(); } } public static object[] columns() { object[] obj; obj = new object[11]; obj[0] = "x = 1, 2, 3, 4"; for(int o = 0; 0 < 10;o++){ obj[o+1] = "x * " + o; } return obj; } }
your problem here:
for(int o = 0; o < 10;o++){ obj[o+1] = "x * " + o; } return obj;
you using 0<10
loop never ends.
Comments
Post a Comment