Also ich habe folgenden Code:
{
public static void main(String[] args)
{
Text m = new Text();
String[] text = new String[1];
text = m.getArrayString();
System.out.println(text[0] + text[1] + text[2]);
}
}```
```class Text
{
String[] getArrayString()
{
String[] text = new String[3];
text[0] = "Hello,";
text[1] = "
How are you?";
text[2] = " I´m fine.";
return text;
}
}```
Allerdings frage ich mich warum ich keine Exception bekomme. Den in der Main-Methode habe ich angegeben, dass das Stringobjekt eine Komponente (nennt man das so?) hat. Allerdings 3 verwende. Da frage ich mich warum das möglich ist.
LG Huntro