Wednesday, 19th September 02:25
E-mail or Username
Password:
Lost password ? »    
Register »
 EuroMobile - interneta veikals
 
EuroFriends, dating site,ekontakt, e-kontakt, dating, girl, girls,  Communities, Community, Dating site, international acquaintances, search of friends, dialogue and correspondence with schoolmates, Riga, Latvija, sex
 
My Picture

ybg71858012 wrote 906 articles and got 0 comments. The last article was submitted on 17/09/18

Search my blog

  ybg71858012's profile

His/her gallery
Browse all blogs       Write blog articles
Spacer
Spacer

More articles

Spacer
17/09/18 兩性專傢揭秘...
Spacer
17/09/18 愛迪達發佈2017...
Spacer
17/09/18 勞力士手表50英...
Spacer
17/09/18 兩性健康:11招...
Spacer
17/09/18 汕頭學校空氣...
Spacer
 
17/09/18 合肥小夥4550元...
Spacer
17/09/18 從零售商到學...
Spacer
17/09/18 在麥凱樂買瞭...
Spacer
17/09/18 一文看懂慢跑...
Spacer
17/09/18 潮流|Champion x ...
Spacer
Spacer
 

Blog article by ybg71858012

 
Spacer

優秀的java程序員都會寫註釋 可以少走20%彎路,你的java註釋瞭嗎?

Date 17/04/18 07:37 Views 35 Сomments 0

Spacer Add to my favorite blogs

<img alt="" src="www.dozo888.com />

<p><strong> 言</strong></p >
<p>今天我們來 說如何編寫Java註 。使用過Java的同 都非常熟悉,Java 有:</p>
<p>§單行註釋// 這是單註釋</p>
<p>§多行註釋/* 這是多行註釋*/</ p>
<p>§Javadoc註釋/ **這是javadoc註釋*/&l t;/p>
<p>其實這裡面 有很多細節呢, 面我們一一來揭曉 </p>
<p style="text-align: center;"></p>
<p><strong> 這裡相信有許多想 要學習Java的同學, 大傢可以關註小編 眾號卓越新騰。&l t;/strong></p>
<p>哪些地方需要添加註釋</p>
<p>首先,我們 要確定一下,添 註釋的目的是什麼 ?(手動思考10秒)。 </p>
<p>我認為添加 釋,是為瞭程序 容易理解與維護, 特別是維護,更是 自己代碼負責的 種體現。</p>
<p>那基於這樣 目的,在日常開 中,我們需要在哪 些地方添加註釋呢 </p>
<p>§類,接口。</p>
<p>這一部分註 是必須的。在這 ,我們需要使用jav adoc註釋,需要標明 ,創建者,創建時 ,版本,以及該 的作用。如下所示 :</p>
<p>package com.andyqian.utils;/*** @author: andy* @date: 18-01-05* @version: 1.0.0* @deion: 生成PDF 工具類*/public class PdfUtil {</p>
<p>췽</p>
<p>ڷУ҂ Ҫ녢Լ Ҫʾ&l t;/p>
<p>/** * pdfļ * @param htmlContent pdf html * @param file pdfļַ * @see PdfUtils#getFontPath() * @return true ɳɹ false ʧ */ public static boolean generatePdf(String htmlContent,File file){ ... return result; }</p>
<p>쳣</p>
<p>҂Ҫ ʹö]ጣMИԓ ;ʾ:</ p>
<p>/*** @author: andy* @date: 18-01-05* @version: 0.0.1* @deion/public class StatusConsts { /** * ͵ַ */ public static final String BLOG="www.andyqian.c om";}</ p>
<p>PI㷨</p>
<p>PI㷨ϣ ]ጁKҰΘ ԓʲN@N ʾ:</p>
<p>/** * È: * 1.windows,ʹThread. currentThread()@ȡ·r ,FՌ󣬌²ʹ * 2.linux,ʹPdfUtils.class@ȡ·null, * @ȡw· * @return w· */ private static String getFontPath(){ String path=""; // 1. ClassLoader classLoader= Thread.currentThread().ge tContextClassLoader() 9; URL url = (classLoader==null)?null: classLoader.getResource(& quot;/"); String threadCurrentPath = (url==null)?"":url.getPath(); // 2. ̫@ȡnull,tʹ ǰPdfUtils.classd· if(threadCurrentPath==nul l||"".equals(th readCurrentPath)){ path = PdfUtils.class.getClass() .getResource("/" ;).getPath(); } // 3.ƴw· StringBuffer stringBuffer = new StringBuffer(path); stringBuffer.append(" ;/fonts/SIMKAI.TTF") ; path = stringBuffer.toString(); return path; }</p>
<p>N]?</p>
<p>1. IDEA Ԅ</p>
<p>е]ጣ ҂ͨ^IDEAԄ ɡ</p>
<p>IDEA ͨ^File->&# 059;Settings->;Edi tor->;File and Code Templates->;Includes->;File HeaderOģ壬@½ ļrIDEAOõ ģ壬Ԅһ]ጣ ͲҪһһòt&l t;/p>
<p></p>
<p>И˺:</p>
<p>${USER} : ǰÑ</p>
<p>${DATE} : ǰڡ</p>
<p>${PACKAGE_N AME}</p&g t;
<p>${TIME}: ǰrg</p>
<p>${YEAR} ǰꡣ</p>
<p>${MONTH}ǰ¡</p>
<p>${DAY}: ǰա</p>
<p>${HOURS} ǰСr</p>
<p>${MINUTE}: ǰ</p>
<p>1.]</p>
<p>òt ķ] wFأĵѣԓ lFtģ</ p>
<p>/** * pdfļ * @param htmlContent pdf html * @param file pdfļַ * @see PdfUtils#getFontPath() * @return true ɳɹ false ʧ */ public static boolean generatePdf(String htmlContent,File file){ ... return result; }</p>
<p>е@see@ãZ:</p>
<p>@see package.class#method label@see #field@see #method(Type, Type,...)@see #method(Type argname, Type argname,...)@see #constructor(Type, Type,...)@see #constructor(Type argname, Type argname,...)</p>
<p>:</p>
<p>@see PdfUtils#getFontPath()</p>
<p>ͬһ package(ȫ·) ʡԡͬܵĘ˺: </p>
<p>{@linkpacka ge.class#metod}</ p>
<p>/** * pdfļ * @return true ɳɹ false ʧ * @throws Exception * {@link PdfUtils#getFontPath()} */ public static boolean generatePdf(String htmlContent,File file){ .... }</p>
<p>^eǣ@ seeҪ]ף 3;@link}λ á</p>
<ol>
<li>IDEAУ҂ xзͨ^ ICtrl+Dɲ鿴҂ӵ ]ጣˆDʾ:</li& gt;
</ol>
<p></p>
<p>1.Ҫ WBӣ҂ͨ 4;HTML˺еa˺ʾ ʾ:</p>
<p>@see <;ahref="www.andyqian.com">;͵ַ<;/a>;</p>
<p>žjavadoc Ҫ֪]ጘ˺:</p>
<p>@see /</p>
<p>@author: ߡ</p>
<p>@dateڡ</p>
<p>@version: 汾̖</p>
<p>@throwsϢ</p>
<p>@param</p>
<p>@return ֵ</p>
<p>@since: _ԴĿô˘˺춄 </p>
<p>{@value}: ʹԓֵ춳</p>
<p>{@link} /</p>
<p>{@linkplain} c@linkһ¡</p>
<p>:</p>
<p>package com.andyqian.pdf.utils;import com.itextpdf.text.log.Logger;import com.itextpdf.text.log.LoggerFactory;import java.io.File;import java.net.URL;/*** @author: q* @date: 18-01-05* @version: 1.0.0* @deion: PDF */public class PdfUtils { private static final Logger logger = LoggerFactory.getLogger(PdfUtils.class); /** * pdfļ * @param htmlContent pdf html * @param file pdfļַ * @see <;a href="itextpdf.com * @return true ɳɹ false ʧ */ public static boolean generatePdf(String htmlContent,File file)throws Exception{ ... return true; } /** * È: * 1.windows,ʹThread. currentThread()@ȡ·r ,FՌ󣬌²ʹ * 2.linux,ʹPdfUtils.class@ȡ·null, * @ȡw· * @return w· */ private static String getFontPath(){ String path=""; // 1. ClassLoader classLoader= Thread.currentThread().ge tContextClassLoader() 9; URL url = (classLoader==null)?null: classLoader.getResource(& quot;/"); String threadCurrentPath = (url==null)?"":url.getPath(); // 2. ̫@ȡnull,tʹ ǰPdfUtils.classd· if(threadCurrentPath==nul l||"".equals(th readCurrentPath)){ path = PdfUtils.class.getClass() .getResource("/" ;).getPath(); } // 3.ƴw· StringBuffer stringBuffer = new StringBuffer(path); stringBuffer.append(" ;/fonts/SIMKAI.TTF") ; path = stringBuffer.toString(); return path; }}</p>
<p>]ጕrһch</p>
<p>1.Уӿڵȱ Єrgˣ ̖]ጡ</p&g t;
<p>2.]ጲԽԽ ã磺get/setͲ Ҫ]ጡҪÿһ ж]ጡ</p>
<p>3.]Ҫĺ ׶؄eǷą Լֵ</p>
<p>4.ÿһ޸ĕr ]ҲMͬ ¡</p>
<p>5.ӿڣУԓʹ/** */javadoc]ጡ@& #123;߾ͲҪM뷽 Ȳ֪̎ ߾aЧʡ</p>
<p>6.a ֣֮ÌaҲ ̖123ȡ< ;/p>
<p>7.öeеÿһ ֵҪ]ጡ</p& gt;
<p><strong>С Y</strong></p&g t;
<p>]һ T׌Լ͈F꠶ һһc] ]еĿNһ T͵qt(̎ʡN )֪ゃЛ]п� 94;_ԴĿԴa] ஔԔԶ ȡeһq ijT</p>
<p>λֵܽã WjavaԒ́׿Խ vɣ</p>
<p></p>
<p>΢Ź̖fcjyzyxt</p> <a href="www.dozo8.com.tw ĹٷWվ</a>]<a href="www.dozo8.com.tw
<hr />
<div style="text-align: center; color:#c00;font-size: 14px;">
棬؛Ʒُȫ/؛ͶYƷ<a style="font-weight: bold; font-size: 16px;" href="line.meҲɒ߶aӺѣ<br />
<a href="line.me src="www.dozo888.com
</div>}

Spacer
Spacer
Spacer
 

Comments on this blog article

Spacer Spacer
 
Sorry there is no comment on this blog article yet. Would you like to be the first one to write a comment?
Spacer
 

Drop your comment for this article

Spacer Spacer
Spacer
  Sorry, guests or NON-ACTIVE-USER can not post comments | Register
Spacer
Spacer
Designed by EuroFriends
© 2008-2014 EuroFriends, All rights reserved.
 BimBom-bernu kafejnice
www.euromobile.lv www.bimbom.lv