<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[JavaRanch: Latest posts for the topic " Generics Confusion in Overriding a method"]]></title>
		<link>http://www.coderanch.com/forums/t/24/Programmer-Certification-SCJP/Generics-Confusion-Overriding-method</link>
		<description><![CDATA[Latest messages posted in the topic " Generics Confusion in Overriding a method"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[ I am facing a problem in generics inheritance. I wrote foll 2 classes couldn't figure out why getting  the compiler error. I read Angelika site regarding overriding but couldn't understand the foll :-----------<br /> <br /> <br />  //GENERIC SUPERCLASS<br />   class superc&lt;T&gt;{<br /> <br />         void set(T arg){}<br /> <br />  }<br /> <br /> <br /> <br />  //GENERIC SUBCLASS<br /> <br />  class subc extends superc&lt;Number&gt;{<br /> <br /> 	void set(Object rr){}<br />  }<br /> <br /> <br /> <b>On compiling above code I get foll compiler error.</b> :-<br /> <br /> superc.java:10: name clash: set(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" class="api" title="Java API" target="_new" rel="nofollow">java.lang.Object</a>) in subc and set(T) in <br /> superc&lt;<a href="http://java.sun.com/javase/6/docs/api/java/lang/Number.html" class="api" title="Java API" target="_new" rel="nofollow">java.lang.Number</a>&gt; have the same erasure, yet neither overrides the other<br />  class subc extends superc&lt;Number&gt;{<br />  ^<br /> <b>1 error</b><br /> <br />  CAN ANYONE HELP ??]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2005830</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2005830</link>
				<pubDate><![CDATA[Sun, Jun 21 2009 06:37:49 MDT]]></pubDate>
				<author><![CDATA[Soniaa Agarwal]]></author>
			</item>
			<item>
				<title> Generics Confusion</title>
				<description><![CDATA[<blockquote class="uncited">
			<div>CAN ANYONE HELP ??</div>
		</blockquote><br /> <br /> First, I am assuming "foll" means "following"?<br /> <br /> <blockquote class="uncited">
			<div>superc.java:10: name clash: set(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" class="api" title="Java API" target="_new" rel="nofollow">java.lang.Object</a>) in subc and set(T) in <br /> superc&lt;<a href="http://java.sun.com/javase/6/docs/api/java/lang/Number.html" class="api" title="Java API" target="_new" rel="nofollow">java.lang.Number</a>&gt; have the same erasure, yet neither overrides the other </div>
		</blockquote><br /> <br /> The error message is pretty clear. You have two overloaded methods set(T) and set(Object). These methods are overloading -- not overriding. Yet, after type erasure (generics is compile only), the methods have the same signature.<br /> <br /> It is not possible for two methods with the same signature, to be overloaded methods.<br /> <br /> Henry]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2005839</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2005839</link>
				<pubDate><![CDATA[Sun, Jun 21 2009 06:51:13 MDT]]></pubDate>
				<author><![CDATA[Henry Wong]]></author>
			</item>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[<br />   Thanks Henry for the prompt reply but I am still not getting it. How come <br />   methods <b>set(T) and set(Object). </b>  are overloaded methods. <br /> <br />   <br />  Why does the following work :<br /> <br /> <br />   <br />  class superc&lt;T&gt;{<br /> <br />                  void set(T arg){}<br /> <br />  }<br /> <br /> <br />  class subc extends superc&lt;Number&gt;{<br /> <br /> 	void set(<b>Number</b> aa){}<br /> <br />  }]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2005840</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2005840</link>
				<pubDate><![CDATA[Sun, Jun 21 2009 07:00:28 MDT]]></pubDate>
				<author><![CDATA[Soniaa Agarwal]]></author>
			</item>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[<br /> <br /> <b>   Is Generics Inheritance on the SCJP 5.0 exam.</b><br />  <br />    Where should I study it from besides Angelika Langer. ]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2005844</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2005844</link>
				<pubDate><![CDATA[Sun, Jun 21 2009 07:12:32 MDT]]></pubDate>
				<author><![CDATA[Soniaa Agarwal]]></author>
			</item>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[Go   for  Kathy & bert bates  SCJP   book its  really good  ......telling you from my experience sonia  ]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2005898</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2005898</link>
				<pubDate><![CDATA[Sun, Jun 21 2009 10:17:06 MDT]]></pubDate>
				<author><![CDATA[suavedeep kaur]]></author>
			</item>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[Hi Soniaa,<br /> If you get more knowledge on Generics then its an advantage for you.<br /> You can refer Sun <a href="http://www.javaranch.com" class="faq" title="A Friendly Place for Java Greenhorns" target="_new">Java</a> Tutorial.]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2005922</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2005922</link>
				<pubDate><![CDATA[Sun, Jun 21 2009 11:20:28 MDT]]></pubDate>
				<author><![CDATA[Ninad Kulkarni]]></author>
			</item>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[<br /> <br />   Thanks Henry .<br /> <br />   Finally I think I understand that its overloading and not overriding.<br /> <br /> ]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2006686</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2006686</link>
				<pubDate><![CDATA[Mon, Jun 22 2009 05:28:06 MDT]]></pubDate>
				<author><![CDATA[Soniaa Agarwal]]></author>
			</item>
			<item>
				<title> Generics Confusion in Overriding a method</title>
				<description><![CDATA[<blockquote>
			<div>
				<cite>Soniaa Agarwal wrote:</cite><br />   Thanks Henry for the prompt reply but I am still not getting it. How come <br />   methods <b>set(T) and set(Object). </b>  are overloaded methods. <br /> <br />   <br />  Why does the following work :<br /> <br /> <br />   <br />  class superc&lt;T&gt;{<br /> <br />                  void set(T arg){}<br /> <br />  }<br /> <br /> <br />  class subc extends superc&lt;Number&gt;{<br /> <br /> 	void set(<b>Number</b> aa){}<br /> <br />  }</div>
		</blockquote><br /> <br /> Hi Sonia,<br />  Can you pleaseadd why did void set(<b>Number</b> aa){} work?]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/450646/2015715</guid>
				<link>http://www.coderanch.com/forums/posts/preList/450646/2015715</link>
				<pubDate><![CDATA[Sun, Jul 5 2009 10:48:09 MDT]]></pubDate>
				<author><![CDATA[reji singh]]></author>
			</item>
	</channel>
</rss>
