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.
Answers: 2
Computers and Technology, 17.09.2019 04:30, rhettperkins
Answers: 2
Computers and Technology, 17.09.2019 22:30, amw32906
Answers: 1
Engineering, 06.10.2019 07:30, rimcdaniel2
Answers: 2
Consider the following implementation of a class square:
public class square
{
pr...
public class square
{
pr...
Mathematics, 05.06.2020 02:01
Mathematics, 05.06.2020 02:01
Chemistry, 05.06.2020 02:01