---
title: "Discussion on \"08 Java - Classes (Part II - Generic Class)\" | Hashnode"
description: "Discussion on \"08 Java - Classes (Part II - Generic Class)\". Introduction to Generic Classes\nIf we have an object with a field of type Object, then this object can hold any type of class because Object is the parent class of all classes. Therefore, when accessing the field of this class, we should be careful b..."
url: "https://hashnode.com/posts/08-java-classes-part-ii-generic-class/663787af407d17e298b986c0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [08 Java - Classes (Part II - Generic Class)](https://chetan77.hashnode.dev/08-java-classes-part-ii-generic-class?utm_source=hashnode&utm_medium=feed)

Introduction to Generic Classes If we have an object with a field of type Object, then this object can hold any type of class because Object is the parent class of all classes. Therefore, when accessing the field of this class, we should be careful b...

May 5, 2024 · 7 min read · chetan77.hashnode.dev  
Read the article

-   [#java-class](https://hashnode.com/tag/java-class)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#generics](https://hashnode.com/tag/generics)
-   [#classes](https://hashnode.com/tag/classes)

## Written by

[Chetan Datta](https://hashnode.com/@chetan77)

@chetan77 · Hyderabad, India

  
[View profile](https://hashnode.com/@chetan77)

Software Engineer

I share my learnings here. Thanks for reading.

## Responses 1

Markdown supported · ⌘↵ to post

[Rahul jaiswal](https://hashnode.com/@Rjais08)

[Apr 28, 2025](https://hashnode.com/posts/08-java-classes-part-ii-generic-class/663787af407d17e298b986c0/comment/680edb5ac68c0d565f770749)

In Raw Type of generic class while creating object of class Print its parameter should be Object not Integer. Please correct me If I am wrong.

[Chetan Datta](https://hashnode.com/@chetan77)

[Jun 1, 2025](https://hashnode.com/posts/08-java-classes-part-ii-generic-class/663787af407d17e298b986c0/comment/680edb5ac68c0d565f770749#reply-683c87453e12cc1360c2d505)

Yes, that's right. I showed both types of initialization one after the other to highlight the difference.

If we don't pass any arguments, it will by default take the type Object.

In the raw type, we don't pass any arguments during initialization.

Print rawTypePrintObject = new Print();
