DEV Community

betpido
betpido

Posted on

ADDRESS JAVA CODE EXPLAINED IN SIMPLE TERMS

'Address' is a Java class that contains the city, town and zipcode of a person. So that we can know the city, town and zipcode of someone we want to meet.

line 9: 'Address' is a class that can be accessed anywhere in the project, because it is 'public'. It implements 'Serializable' because we want to save the address of the person on a computer, and retrieve it later.

line 11: 'city' is a private variable. Meaning you cannot use it everywhere in the project. It will contain the name of city the person lives in. Its type is 'String' because the name of a city is a combination of letters.

line 12: 'town' is a private variable. Meaning you cannot use it everywhere in the project. It will contain the name of the town in the city the person lives in. Its type is 'String' because the name of a town is a combination of letters.

line 13: 'zipCode' is also a private variable. It will contain the zipCode of the person. Its type is 'int' because the zipCode is a combination of numbers.

Top comments (0)