Answer the question
In order to leave comments, you need to log in
Same values in array of objects?
There is a Human class
public class Human {
public static String name;
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public class Main {
public static void main(String[] args) {
Human humans[] = new Human[4];
humans[0].setName("zzz");
humans[1].setName("xxx");
humans[2].setName("qqq");
humans[3].setName("www");
System.out.println(humans[1].getName());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question