Which statement declares a generic class?

Which statement declares a generic class?

Which statement declares a generic class?

A.
public class Example < T > { }

B.
public class <Example> { }

C.
public class Example <> { }

D.
public class Example (Generic) { }

E.
public class Example (G) { }

F.
public class Example { }

Explanation:

Example:
public class Pocket<T>
{
private T value;
public Pocket() {}
public Pocket( T value ) { this.value = value; }
public void set( T value ) { this.value = value; }
public T get() { return value; }
public boolean isEmpty() { return value != null; }
public void empty() { value = null; }
}



Leave a Reply 1

Your email address will not be published. Required fields are marked *