subject
Computers and Technology, 06.11.2019 22:31 cam961

Consider the following implementation of a class square:
public class square
{
private int sidelength;
private int area; // not a good idea
public square(int length){
sidelength = length;
}
public int getarea(){
area = sidelength * sidelength;
return area;
}
}
why is it not a good idea to introduce an instance variable for the area? rewrite the class so that area is a local variable.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:00
In which part of a professional email should you try to be brief, but highly descriptive?
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Does anybody know how to hack into a google account? i had important information on it and it is gone now and i need getting it back.
Answers: 1
You know the right answer?
Consider the following implementation of a class square:
public class square
{
pr...
Questions
question
Mathematics, 18.12.2019 20:31
Questions on the website: 13722367