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 00:30
Advantages and disadvantages of binary system
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 23.06.2019 12:30
Animations and transitions are added from the
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Uget brainliest if accurate mary has been given the responsibility of hiring a person for the position of a software testing officer. which management function would mary achieve this responsibility?
Answers: 1
You know the right answer?
Consider the following implementation of a class square:
public class square
{
pr...
Questions
question
Mathematics, 11.06.2021 07:00
question
Mathematics, 11.06.2021 07:00
question
Mathematics, 11.06.2021 07:10
question
Mathematics, 11.06.2021 07:10
question
English, 11.06.2021 07:10
question
Mathematics, 11.06.2021 07:10
Questions on the website: 13722362