public class ReferenceTest {
public static void main(String[] args) {
String[][] names = {{"George","Hampton"},{"Marc", "Empten"},{"Levin", "Lian"}};
Object oneperson; //Reference to one object of the 2D Array
oneperson = names[1];
//Output should be Marc Empten
System.out.println(oneperson.toString()); //[Ljava.lang.String;@11890d
}
}
Is it possible to create such a reference in java? So I can save an array-element(
{"Marc","Empten"}
) from the array?
So I can use only the oneperson variable to give out the "Marc Empten"? I have no Idea how to realise this. Is it even possible?