<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>方法重载</title>
	<atom:link href="https://www.aitaocui.cn/tag/219678/feed" rel="self" type="application/rss+xml" />
	<link>https://www.aitaocui.cn</link>
	<description>翡翠玉石爱好者聚集地</description>
	<lastBuildDate>Fri, 25 Nov 2022 10:22:56 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>https://www.aitaocui.cn/wp-content/uploads/2022/11/taocui.png</url>
	<title>方法重载</title>
	<link>https://www.aitaocui.cn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>方法重载(同一个类中定义多个同名方法)</title>
		<link>https://www.aitaocui.cn/article/331303.html</link>
					<comments>https://www.aitaocui.cn/article/331303.html#respond</comments>
		
		<dc:creator><![CDATA[黄辉冯]]></dc:creator>
		<pubDate>Fri, 25 Nov 2022 10:22:56 +0000</pubDate>
				<category><![CDATA[百科]]></category>
		<category><![CDATA[方法重载]]></category>
		<guid isPermaLink="false">https://www.aitaocui.cn/?p=331303</guid>

					<description><![CDATA[指同一个类中定义多个同名方法，但是要求每个方法具有不同的参数类型或数量不同。。调用重载方法时，Java编译器能通过检查调用的方法的参数类型和个数选择一个恰当的方法。方法重载通常用于...]]></description>
										<content:encoded><![CDATA[</p>
<article>
<p>指同一个类中定义多个同名方法，但是要求每个方法具有不同的参数类型或数量不同。。调用重载方法时，Java编译器能通过检查调用的方法的参数类型和个数选择一个恰当的方法。方法重载通常用于创建完成一组任务相似但参数的类型或参数的个数不同的方法。方法重载是让类以统一的方式处理不同类型数据的一种手段。Java的方法重载，就是在类中可以创建多个方法，它们具有相同的名字，但具有不同的参数和不同的定义。调用方法时通过传递给它们的不同个数和类型的参数来决定具体使用哪个方法</p>
</article>
<article>
<h1>简洁</h1>
<p>方法重载是让类以统一的方式处理不同类型数据的一种手段。Java的方法重载，就是在类中可以创建多个方法，它们具有相同的名字，但具有不同的参数和不同的定义。调用方法时通过传递给它们的不同个数和类型的参数来决定具体使用哪个方法。</p>
<p>软道语录</p>
<p>方法重载：</p>
<p>方法重载就是方法名称重复，加载参数不同。</p>
<h1>例子</h1>
<p>class MethodOverloading {</p>
<p>void receive(int i) {System.out.println(&quot;Received one int data&quot;);</p>
<p>System.out.println(&quot;i=&quot;+i);}</p>
<p>void receive(float f) </p>
<p>{System.out.println(&quot;Received one float data&quot;);</p>
<p>System.out.println(&quot;f=&quot;+f);}</p>
<p>void receive(String s) {System.out.println(&quot;Received a String&quot;);</p>
<p>System.out.println(&quot;s=&quot;+s);}</p>
<p>public static void main(String [] args){</p>
<p>MethodOverloading m = new MethodOverloading();</p>
<p>m.receive(3456);</p>
<p>m.receive(34.56f);</p>
<p>m.receive(&quot;方法重载&quot;);}}</p>
<p>注意，Java的方法重载要求同名的方法必须有不同的参数表，仅有返回类型不同是不足以区分两个重载的方法。</p>
</article>
<div class="mt-3 mb-3" style="max-width: 770px;height: auto;">
                                    </div>
<div class="mt-3 mb-3" style="max-width: 770px;height: auto;">
                                    </div>
<div class="mt-3 mb-3" style="max-width: 770px;height: auto;">
                                    </div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aitaocui.cn/article/331303.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
