Jdk5.0 model quiz

Source: Internet
Author: User

I saw a quiz (http://blog.joycode.com/ninputer/archive/2005/11/02/66256.aspx) about the C #2.0 Model in the blog Hall, considering JDK 5.0 has also introduced the model, the purpose of JDK 5.0 to do the corresponding test.

Quiz1:
Determine whether the following code is correct. If there is a mistake, the error type is indicated. If there is no error, the output result is indicated.

Public class genericquiz1
{

Public static void main (string [] ARGs)
{
A <integer> A = new A <integer> ();
A. internalcall (2005 );
}

}

Class A <t>
{
Void internalcall (t p)
{
Test (P );
}

Void test (t p)
{
System. Out. println ("use t ");
}

Void test (integer p)
{
System. Out. println ("use integer ");
}
}

Quiz2:
Determine whether the following code is correct. If there is a mistake, the error type is indicated. If there is no error, the output result is indicated.
Public class genericquiz1
{

Public static void main (string [] ARGs)
{
A <integer> A = new A <integer> ();
A. Test (2005 );
}

}

Class A <t>
{

Void test (t p)
{
System. Out. println ("use t ");
}

Void test (int p)
{
System. Out. println ("use int ");
}
}

Quiz3:
Determine whether the following code is correct. If there is a mistake, the error type is indicated. If there is no error, the output result is indicated.
Public class genericquiz1
{

Public static void main (string [] ARGs)
{
A <integer> A = new A <integer> ();
A. Test (2005 );
}

}

Class A <t>
{

Void test (t p)
{
System. Out. println ("use t ");
}

Void test (integer p)
{
System. Out. println ("use integer ");
}
}

Quiz4:
Determine whether the following code is correct. If there is a mistake, the error type is indicated. If there is no error, the output result is indicated.
Public class genericquiz1
{

Public static void main (string [] ARGs)
{
A <integer> A = new A <integer> ();
A. Test (2005 );
}

}

Class A <t>
{

Void test (t p)
{
System. Out. println ("use t ");
}

<U> void test (u p)
{
System. Out. println ("use U ");
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.