class Name{
String name;
Name(String name){
this.name = name;
}
void changeName(String name){
this.name = name;
}
String getName(){
return this.name;
}
void swap(Name other_Name_object){
String temp;
temp = other_Name_object.getName();
other_Name_object.changeName(this.name);
this.name = temp;
}
public String toString(){
return this.name;
}
}
I'm not sure why my code doesn't run on my java compiler. It has the same name as the file names.java