here is my entire code. now, the only problem I have stumbled upon is in the last method, getRow, where i have to extract a row from an array of string. could anyone please help me with this, i've been stuck for hours, not knowing why it calls "missing return statement", when i clearly do it -.-' thank you in advance
import java.util.ArrayList;
public class Photograph
{
private String[] photograph;
public Photograph(String[] photograph)
{
if (photograph == null)
photograph = new String[] {""};
else this.photograph = photograph;
}
public int getWidth()
{
return (photograph[0]).length();
}
public int getHeight()
{
return photograph.length;
}
/**
* @null if the index is out of bounds.
*/
public String getLine(int index)
{
if (index < 0 || index >= getHeight())
return null;
return photograph[index];
}
public String getRow(int index)
{
if (index < 0 || index >= getWidth())
return null;
for (int row = 0; row < getHeight(); row++)
return photograph[row].substring(index, index + 1);
}
}