Object Oriented Programming: Unit IV: I/O, Generics, String Handling

Restrictions and Limitations

Generics | Java OOPs

In Java, generic types are compile time entities. The runtime execution is possible only if it is used along with raw type.Primitive type parameters is not allowed for generic programming.

Restrictions and Limitations

1. In Java, generic types are compile time entities. The runtime execution is possible only if it is used along with raw type.

2. Primitive type parameters is not allowed for generic programming.

For example: Stack<int> is not allowed.

3. For the instances of generic class throw and catch instances are not allowed.

For example:

public class Test<T> extends Exception

{

//code // Error:can't extend the Exception class

}

4. Instantiation of generic parameter T is not allowed.

For example:

new T() //Error

new T[10]

5. Arrays of parameterized types are not allowed.

For example:

new Stack<String>[10];//Error

6. Static fields and static methods with type parameters are not allowed.

Object Oriented Programming: Unit IV: I/O, Generics, String Handling : Tag: : Generics | Java OOPs - Restrictions and Limitations


Object Oriented Programming: Unit IV: I/O, Generics, String Handling



Under Subject


Object Oriented Programming

CS3391 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation



Related Subjects


Discrete Mathematics

MA3354 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Digital Principles and Computer Organization

CS3351 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Foundation of Data Science

CS3352 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Data Structure

CS3301 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation


Object Oriented Programming

CS3391 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation