java - Why is this "if" a "dead code"? -
java - Why is this "if" a "dead code"? -
i have next code :
/** width of each brick in pixels */ private static final int brick_width = 11; /** width of each brick in pixels */ private static final int brick_height = 12; /** number of bricks in base of operations of pyramid */ private static final int bricks_in_base = 14; public void run () { int lowerleftside; if (brick_width / 2 == 0) { lowerleftside = ((getwidth()/2) - (brick_width*(bricks_in_base/2))); }else lowerleftside = ((getwidth()/2) - (brick_width*(bricks_in_base/2-1))); eclipse marks whole if dead code. initialize value @ origin of run method.
thanks.
looks brick_width constant, brick_width/2 known @ compile time , eclipse knows path taken, other 1 dead code.
java
Comments
Post a Comment