What Will Be The Output Of The Following Java Codep Pre #658
What will be the output of the following Java code?</p> <pre><code class="language-java"> class Generic<T,U> { T t; U u; Generic(T t, U u) { this.t = t; this.u = u; } public void append() { System.out.print(u); System.out.print(t); } } class GenericString { public static void main (String[] args) { Generic <String, String> i = new Generic<String, String>("San", "foundry"); i.append(); } }</code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs111 OOP Object Oriented Programming Java. It can also be found in gs gs111 Types of Classes (Using Java) - Generic Class - Quiz No.1.
What will be the output of the following Java code?
class Generic<T,U> { T t; U u; Generic(T t, U u) { this.t = t; this.u = u; } public void append() { System.out.print(u); System.out.print(t); } } class GenericString { public static void main (String[] args) { Generic <String, String> i = new Generic<String, String>("San", "foundry"); i.append(); } }
Compilation Error
Runtime Error
NVAEducation
foundrySan