Hallo allerseits,
diese folgende Frage konnte ich leider nicht richtig beantworten:
-----------------
Given that CharSequence is an interface implemented by both String and StringBuilder classes, and then given the following method:
public <S extends CharSequence > S hepp( s) {
// INSERT HERE
}
Which of the following can be inserted at // INSERT HERE to compile and run without error?
a) return s;
b) return (Object) s;
c) return s.toString();
d) return new StringBuilder(s);
e) return (S) new StringBuilder(s);
f) return null;
------------------
Wer kann mir gut und verständlich erklären welche warum die richtige Antwort ist?
Viele Grüße
Steve222
diese folgende Frage konnte ich leider nicht richtig beantworten:
-----------------
Given that CharSequence is an interface implemented by both String and StringBuilder classes, and then given the following method:
public <S extends CharSequence > S hepp( s) {
// INSERT HERE
}
Which of the following can be inserted at // INSERT HERE to compile and run without error?
a) return s;
b) return (Object) s;
c) return s.toString();
d) return new StringBuilder(s);
e) return (S) new StringBuilder(s);
f) return null;
------------------
Wer kann mir gut und verständlich erklären welche warum die richtige Antwort ist?
Viele Grüße
Steve222