It says illegal start of expression at Line 20 but I don't know what is wrong with it.
Or you just can't make loop at void method?
package com.codegym.task.task05.task0513;
public class Rectangle {
int top;
int left;
int width = top;
int height = left;
int i = 0;
public void rectloop (){
for (i=1; i<5; i++)
{
public void initialize(int i){
this.top = i;
this.width;
this.left = i + 1;
this.height;
}
;}
}
public static void main(String[] args) {
}
}
package com.codegym.task.task05.task0513;
/*
Let's put together a rectangle
*/
public class Rectangle {
//write your code here
int top;
int left;
int width = top;
int height = left;
int i = 0;
public void rectloop (){
for (i=1; i<5; i++)
{
public void initialize(int i){
this.top = i;
this.width;
this.left = i + 1;
this.height;
}
;
}
}
public static void main(String[] args) {
}
}