Deepak Bala wrote:The generic that is defined is never really used. What do you mean by 'how does the compiler treat it ?'
Saibabaa Pragada wrote:How does the compiler/we can convert this generic style code methods in to non-generic style code methods ?
For example, Define class : class Animal<T> {}
Create Instance: Animal<Cat> ref = new Animal<Cat>();
The compile/we can treat/assume the class as class Animal<Cat>{} instead of class Animal<T> {}
Deepak Bala wrote:The generic that is defined is never really used. What do you mean by 'how does the compiler treat it ?'
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
mohammed sanaullah wrote:Is Type Erasure what you were looking for?
Saibabaa Pragada wrote:I am trying to understand how these 2 generic methods can be written as Non-generic methods.
mohammed sanaullah wrote:Is Type Erasure what you were looking for?
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Saibabaa Pragada wrote:We cannot pass int, double, String as arguments because show() method doesn't take any parameters
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Saibabaa Pragada wrote:I don't understand whether you are asking or saying. Please provide full sentence with complete meaning.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Saibabaa Pragada wrote:They all work fine because method has generic type. My question is whole different. Let me put it in this way.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Don't get me started about those stupid light bulbs. |