My last return statement does not work can anyone tell me why? I am completly lost!
public class IpAddress
{
private String dottedDecimal;
private int[] Octet= new int[4];
public int i;
//Default constructor
public IpAddress()
{
dottedDecimal = "0.0.0.0";
for ( i=0; i<=3;i++)
{
Octet[i] = 0; //setting the array to zero
}
} // end default constructor
//************************************
//Specified constructor
public IpAddress(String myAddress)
{
dottedDecimal = myAddress;
String[] parsedOctets;
parsedOctets = myAddress.split("\\Q.\\E"); // allows to stop at the dot
for (i=0; i <=3; i++)
{
Octet[i] = Integer.parseInt(parsedOctets[i]); // breaking the string down to integers
}
}// end specified constructor
//*****************************************************
public String getDottedDecimal()
{
return dottedDecimal;
}
//*********************
public int getOctet()
{
for (this.i=0; this.i <=3; this.i++)
{
return this.Octet[i];
}
}
} // end ip address class