Skip to main content
Clarified "correct English"
Source Link
200_success
  • 145.7k
  • 22
  • 191
  • 481

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizens.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct englishEnglish spelling and follow Java capitalization conventions when you name a variable:

boolean afirmativeanswer = true;
boolean afirmativeanswer = true;

wouldshould be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizens.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizens.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct English spelling and follow Java capitalization conventions when you name a variable:

boolean afirmativeanswer = true;

should be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

deleted 4 characters in body
Source Link

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizensListcitizens.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizensList.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizens.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

added 6 characters in body
Source Link

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizensList.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizensList.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't need to use afirmativeanswer

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Naming

Naming is fundamental to make your code easier to read.

ArrayList<Citizens> list = new ArrayList<Citizens>();

Name this to citizensList.

Citizens p1 = new Portuguese();

p1 is not an adequate name. Rather name it as person1. Replace also p2 to person2.

Rename Citizens to Citizen: person1 is Citizen not Citizens. Same thing for person2.

Also use correct english when you name a variable:

boolean afirmativeanswer = true;

would be affirmativeAnswer.

Java is a language where CamelCase is mostly respected. Why didn't you use it?

Method

  • A constructor is mostly used to access that classes methods and attributes parallel to other objects created.

  • For an infinite-loop, you can do while(true) (preferred) or for(;;). Use break to exit from the while loop. So you don't even need to use afirmativeanswer.

  • Use toLowerCase() method to not differentiate from inputting UPPERCASE or lowercase characters.

  • There is no need to make answer and answernr instance variables. Just put them into the methods when you need them.

Source Link
Loading