mycpen-blog 0.0.0-fibiffajvp → 0.0.0-fiuyegukhx

Sign up to get free protection for your applications and to get access to all the features.
package/search.xml CHANGED
@@ -1493,7 +1493,7 @@
1493
1493
  <link href="/posts/12907.html"/>
1494
1494
  <url>/posts/12907.html</url>
1495
1495
 
1496
- <content type="html"><![CDATA[<p><a href="https://www.bilibili.com/video/BV1fh411y7R8">视频链接:https://www.bilibili.com/video/BV1fh411y7R8</a></p><h2 id="一-就业方向">一. 就业方向<a class="header-anchor" href="#一-就业方向"></a></h2><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080320118.png" alt="image-20220508032024978" style="zoom:50%;" /><hr><h2 id="二-开发场景">二. 开发场景<a class="header-anchor" href="#二-开发场景"></a></h2><p>Java 开发场景举例 1-<code>SSM</code></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080322295.png" alt=""></p><p>Java 开发场景举例 2:<code>Android 核心代码</code></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080324796.png" alt=""></p><p>Java 开发场景举例 3:<code>大数据-hadoop </code></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080325177.png" alt=""></p><hr><h2 id="三-应用领域">三. 应用领域<a class="header-anchor" href="#三-应用领域"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>企业级应用</p></li></ul><p>主要指复杂的大企业的**<code>软件系统</code><strong>、各种类型的</strong><code>网站</code>**。应用领域包括金融、电信、交通、电子商务等。</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080327015.png" alt="image-20220508032702906" style="zoom:50%;" /><ul class="lvl-0"><li class="lvl-2"><p>Android 平台应用</p></li></ul><p>Android 应用程序使用 Java 语言编写。Android 开发水平的高低很大程度上取决于 Java 语言核心能力是否扎实。</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080327181.png" alt="image-20220508032750052" style="zoom:50%;" /><ul class="lvl-0"><li class="lvl-2"><p>移动领域应用</p></li></ul><p>主要表现在消费和嵌入式领域,是指在各种小型设备上的应用,包括机顶盒、车载的大屏影音娱乐设备、汽车通信设备、扫码的 POS 机等。</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080329788.png" alt="image-20220508032900704" style="zoom:50%;" /><hr><h2 id="四-程序举例">四. 程序举例<a class="header-anchor" href="#四-程序举例"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong>什么是程序</strong></p></li></ul><p>程序:计算机执行某些操作或解决某个问题而 <strong><code>编写的一系列有序指令的集合</code></strong></p><p>举例说明:</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080343728.png" alt="image-20220508034312623" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080343441.png" alt="image-20220508034326323" style="zoom: 67%;" /></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//老师写的最简单的程序,完成 1+1, 体会</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Test</span> &#123;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> <span class="number">1</span> + <span class="number">1</span>;</span><br><span class="line"> <span class="comment">// 显示</span></span><br><span class="line">System.out.print(<span class="string">&quot;结果=&quot;</span> + res);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080403773.png" alt=""></p><hr><h2 id="五-故事">五. 故事<a class="header-anchor" href="#五-故事"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>Java 诞生小故事</p></li></ul><ol><li class="lvl-3"><p><code>1995年 第1个版本</code></p></li><li class="lvl-3"><p><code>Java之父 gosling</code></p></li><li class="lvl-3"><p><code>最新版本:15</code></p></li><li class="lvl-3"><p><code>公司里用的最多的版本:8、11</code></p></li><li class="lvl-3"><p><code>Java 所有权:甲骨文</code></p></li></ol><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080344966.png" alt="image-20220508034456860" style="zoom: 67%;" /><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080408088.png" alt=""></p></blockquote><ul class="lvl-0"><li class="lvl-2"><p>Java 技术体系平台</p></li></ul><blockquote><p><code>标准版、企业版、小型版</code></p><p><code>Java SE、Java EE、Java ME</code></p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080412778.png" style="zoom:50%;" /></blockquote><hr><h2 id="六-特性">六. 特性<a class="header-anchor" href="#六-特性"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong>Java 重要特点</strong></p></li></ul><ol><li class="lvl-3"><p>Java 语言是面向对象的(<strong><code>oop</code></strong>)</p></li><li class="lvl-3"><p>Java <code>语言是健壮的</code>。Java 的强类型机制、异常处理、垃圾的自动收集等是 Java 程序健壮性的重要保证</p></li><li class="lvl-3"><p>Java 语言是**<code>跨平台性的</code>**。[即: <strong>一个编译好的.class 文件可以在多个系统下运行,这种特性称为跨平台</strong>]</p></li></ol><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080415181.png" style="zoom:50%;" /></blockquote><ol start="4"><li class="lvl-3"><p>Java 语言是解释型的[了解]</p></li></ol><p>​<strong>解释性语言:javascript,PHP, java 编译性语言: c / c++</strong></p><p>​区别是:<code>解释性语言</code>,编译后的代码,<code>不能直接被机器执行,需要解释器来执行</code>, <code>编译性语言</code>, 编译后的代码, 可以<code>直接被机器执行</code>, c /c++</p><hr><ul class="lvl-0"><li class="lvl-2"><p><strong>Java 的开发工具</strong></p><ul class="lvl-2"><li class="lvl-4"><p>工具选择</p><ul class="lvl-4"><li class="lvl-6"><p>如何选择开发工具</p><p>​我们先选择用文本编辑器本 sublime,到大家对 java 有一定了解后,我们再使用 IDEA 和 Eclipse 开发工具。</p></li><li class="lvl-6"><p>这是为什么呢</p><p>​更深刻的理解 java 技术,培养代码感。【面试时,往往程序员手写代码】</p><p>​有利于公司面试</p><pre><code> &gt; &lt;img src=&quot;https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080421152.png&quot; alt=&quot;image-20220508042124961&quot; style=&quot;zoom:50%;&quot; /&gt;</code></pre></li></ul></li></ul></li></ul><hr><h2 id="七-jdk介绍、安装、配置">七. jdk介绍、安装、配置<a class="header-anchor" href="#七-jdk介绍、安装、配置"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong>Java 运行机制及运行过程</strong></p><ul class="lvl-2"><li class="lvl-4"><p>Java 语言的特点:<code>跨平台性</code></p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080428588.png" alt="image-20220508042849189" style="zoom:50%;" /></blockquote></li><li class="lvl-4"><p>Java 核心机制-Java 虚拟机 [<code>JVM</code> java virtual machine]</p></li></ul></li><li class="lvl-2"><p><code>Java 核心机制-Java 虚拟机 [JVM java virtual machine]</code></p></li></ul><p><strong>基本介绍</strong></p><ol><li class="lvl-3"><p>JVM 是一个虚拟的计算机,具有指令集并使用不同的存储区域。负责执行指令,管理数据、内存、寄存器,包含在 <strong><code>JDK 中</code></strong>.</p></li><li class="lvl-3"><p>对于不同的平台,有不同的虚拟机。</p></li><li class="lvl-3"><p>Java 虚拟机机制屏蔽了底层运行平台的差别,实现了“一次**<code>编译</code><strong>,到处</strong><code>运行</code>**” [说明]</p></li></ol><p><strong>示意图</strong></p><blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//指令</span></span><br><span class="line">javac<span class="comment">// 编译</span></span><br><span class="line">java<span class="comment">// 运行</span></span><br></pre></td></tr></table></figure><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080434503.png" alt="image-20220508043429400" style="zoom: 67%;" /></blockquote><hr><p><strong><code>什么是 JDK,JRE</code></strong></p><ul class="lvl-0"><li class="lvl-2"><p><code>JDK 基本介绍 </code></p></li></ul><ol><li class="lvl-3"><p>JDK 的全称(Java Development Kit <strong><code>Java 开发工具包</code></strong>)</p></li></ol><p>​JDK = JRE + java 的开发工具 [java, javac,javadoc,javap 等]</p><ol start="2"><li class="lvl-3"><p>JDK 是提供给 Java 开发人员使用的,其中包含了 java 的开发工具,也包括了 JRE。所以安装了 JDK,就不用在单独安装 JRE 了。</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p><code>JRE 基本介绍</code></p></li></ul><ol><li class="lvl-3"><p>JRE(Java Runtime Environment <code> Java 运行环境</code>)</p></li></ol><p>​JRE = JVM + Java 的核心类库[类]</p><ol start="2"><li class="lvl-3"><p>包括 Java 虚拟机(JVM Java Virtual Machine)和 Java 程序所需的核心类库等,如果想要运行一个开发好的 Java 程序,计算机中只需要安装 JRE 即可。</p></li></ol><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080445424.png" style="zoom:67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><code>JDK、JRE 和 JVM 的包含关系</code></p></li></ul><ol><li class="lvl-3"><p><strong><code>JDK = JRE + 开发工具集</code></strong>(例如 Javac,java 编译工具等)</p></li><li class="lvl-3"><p><strong><code>JRE = JVM + Java SE</code></strong> <strong><code>标准类库</code></strong>(java 核心类库)</p></li><li class="lvl-3"><p>如果只想运行开发好的 .class 文件 只需要 JRE</p></li></ol><hr><p><strong>下载、安装 JDK</strong></p><blockquote><p><a href="https://www.oracle.com/java/technologies/downloads/">https://www.oracle.com/java/technologies/downloads/</a></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080450598.png" alt=""></p></blockquote><p><strong>配置环境变量 path</strong></p><ul class="lvl-0"><li class="lvl-2"><p>为什么要配置 path</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080507309.png" alt="image-20220508050732153" style="zoom:50%;" /></blockquote></li><li class="lvl-2"><p>配置环境变量 path 的步骤</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080512224.png" style="zoom:50%;" /></blockquote><hr><p>安装 JDK 的练习</p><blockquote><p>请同学们安装好 JDK,配置好 path 环境变量。可以在控制台下正确的执行, (10min)</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080520103.png" alt="image-20220508052000041" style="zoom:50%;" /><p>环境变量配置细节说明:</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080520181.png" alt="image-20220508052022102" style="zoom:50%;" /><hr><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080521628.png" alt="image-20220508052141440" style="zoom: 50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080528717.png" alt="image-20220508052824602" style="zoom:50%;" /><hr><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080529498.png" alt="image-20220508052931384" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080533822.png" alt="image-20220508053340793" style="zoom: 67%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080534562.png" alt="image-20220508053443524" style="zoom:67%;" /></blockquote><hr><h2 id="八-快速入门">八. 快速入门<a class="header-anchor" href="#八-快速入门"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>需求说明</p></li></ul><p>要求开发一个 Hello.java 程序,可以输出 “hello,world!”</p><ul class="lvl-0"><li class="lvl-2"><p>开发步骤</p></li></ul><ol><li class="lvl-3"><p>将 Java 代码编写到扩展名为 <code>Hello.java 的文件</code>中。[代码说明]</p></li><li class="lvl-3"><p>通过 <code>javac</code> 命令对该 java 文件进行<code>编译</code>,生成 <code>.class</code> 文件。</p></li><li class="lvl-3"><p>通过 <code>java</code> 命令对生成的 class 文件进行<code>运行</code>。</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p>运行原理示意图</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080545433.png" alt="image-20220508054554366" style="zoom: 67%;" /></blockquote><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080607424.png" alt="image-20220508060705278" style="zoom:50%;" /></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//这是java的快速入门, 演示java的开发步骤</span></span><br><span class="line"><span class="comment">//对代码的相关说明</span></span><br><span class="line"><span class="comment">//1. public class Hello 表示Hello是一个类,是一个public公有的类</span></span><br><span class="line"><span class="comment">//2. Hello&#123; &#125; 表示一个类的开始和结束</span></span><br><span class="line"><span class="comment">//3. public static void main(String[] args) 表示一个主方法,即我们程序的入口</span></span><br><span class="line"><span class="comment">//4. main() &#123;&#125; 表示方法的开始和结束</span></span><br><span class="line"><span class="comment">//5. System.out.println(&quot;hello,world~&quot;); 表示输出&quot;hello,world~&quot;到屏幕</span></span><br><span class="line"><span class="comment">//6. ;表示语句结束</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Hello</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;韩顺平教育 hello&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限。[演示]</span></span><br><span class="line"><span class="comment">//Dog 是一个类</span></span><br><span class="line"><span class="comment">//编译后,每一个类,都对于一个.class</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Dog</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限,也可以将main方法写在非public类中,</span></span><br><span class="line"><span class="comment">//然后指定运行非public 类,这样入口方法就是非public 的main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小狗狗~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Tiger</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小老虎~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080611636.png" alt="image-20220508061152606" style="zoom:67%;" /></blockquote><hr><h2 id="九-运行机制">九. 运行机制<a class="header-anchor" href="#九-运行机制"></a></h2><p><strong>Java 开发快速入门</strong></p><ul class="lvl-0"><li class="lvl-2"><p><code>Java执行流程分析</code></p></li></ul><blockquote><p>.java文件源文件</p><p>.class文件字节码文件</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080612745.png" alt="image-20220508061231609" style="zoom: 67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><code>什么是编译</code></p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080619173.png" alt="image-20220508061953033" style="zoom: 67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><code>什么是运行</code></p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080623909.png" alt="image-20220508062339779" style="zoom:67%;" /></blockquote><hr><h2 id="十-开发细节">十. 开发细节<a class="header-anchor" href="#十-开发细节"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong><code>Java开发注意事项和细节说明</code></strong></p></li></ul><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080627135.png" alt="image-20220508062754938" style="zoom: 50%;" /><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Hello</span> &#123;</span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;韩顺平教育 hello&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限。[演示]</span></span><br><span class="line"><span class="comment">//Dog 是一个类</span></span><br><span class="line"><span class="comment">//编译后,每一个类,都对于一个.class</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Dog</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限,也可以将main方法写在非public类中,</span></span><br><span class="line"><span class="comment">//然后指定运行非public 类,这样入口方法就是非public 的main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小狗狗~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Tiger</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小老虎~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080638351.png" alt="image-20220508063831299" style="zoom: 67%;" /></blockquote><hr><h2 id="十一-学习方法">十一. 学习方法<a class="header-anchor" href="#十一-学习方法"></a></h2><blockquote><ul class="lvl-1"><li class="lvl-2"><p>老韩聊: 如何快速掌握技术或知识点</p></li></ul><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081310765.png" alt="image-20220508131030628" style="zoom: 80%;" /></blockquote><hr><h2 id="十二-转义字符">十二. 转义字符<a class="header-anchor" href="#十二-转义字符"></a></h2><p><strong>Java 转义字符</strong></p><ul class="lvl-0"><li class="lvl-2"><p><code>Java 常用的转义字符</code></p></li></ul><p>在控制台,输入 tab 键,可以实现命令补全</p><ol><li class="lvl-3"><p><code>\t</code> :一个<code>制表位</code>,实现对齐的功能</p></li><li class="lvl-3"><p><code>\n</code> :<code>换行符</code></p></li><li class="lvl-3"><p><code>\\</code> :<code>一个\ </code></p></li><li class="lvl-3"><p><code>\&quot;</code> :<code>一个&quot; </code></p></li><li class="lvl-3"><p><code>\'</code> :<code>一个' </code></p></li><li class="lvl-3"><p><strong><code>\r</code></strong> :<strong><code>一个回车</code></strong> System.out.println(“韩顺平教育\r 北京”);</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p>说明</p></li></ul><p>应用实例</p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//演示转义字符的使用</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ChangeChar</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">// \t :一个制表位,实现对齐的功能</span></span><br><span class="line">System.out.println(<span class="string">&quot;北京\t天津\t上海&quot;</span>);</span><br><span class="line"><span class="comment">// \n :换行符</span></span><br><span class="line">System.out.println(<span class="string">&quot;jack\nsmith\nmary&quot;</span>);</span><br><span class="line"><span class="comment">// \\ :一个\ \\</span></span><br><span class="line">System.out.println(<span class="string">&quot;C:\\Windows\\System32\\cmd.exe&quot;</span>);</span><br><span class="line"><span class="comment">// \&quot; :一个&quot;</span></span><br><span class="line">System.out.println(<span class="string">&quot;老韩说:\&quot;要好好学习java,有前途\&quot;&quot;</span>);</span><br><span class="line"><span class="comment">// \&#x27; :一个&#x27;</span></span><br><span class="line">System.out.println(<span class="string">&quot;老韩说:\&#x27;要好好学习java,有前途\&#x27;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// \r :一个回车 System.out.println(&quot;韩顺平教育\r北京&quot;);</span></span><br><span class="line"><span class="comment">// 解读</span></span><br><span class="line"><span class="comment">// 1. 输出 韩顺平教育</span></span><br><span class="line"><span class="comment">// 2. \r表示回车 </span></span><br><span class="line">System.out.println(<span class="string">&quot;韩顺平教育\r北京&quot;</span>); <span class="comment">// 北京平教育</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081323663.png" alt="image-20220508132315623" style="zoom: 67%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081327844.png" alt="image-20220508132732792" style="zoom: 67%;" /><hr><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081328387.png" alt="image-20220508132852344" style="zoom:67%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081329085.png" alt="image-20220508132927045" style="zoom:67%;" /></blockquote><hr><ul class="lvl-0"><li class="lvl-2"><p>课堂练习</p></li></ul><p>要求:请使用一句输出语句,达到输入如下图形的效果 2min</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081331278.png" alt="image-20220508133105218" style="zoom:67%;" /></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ChangeCharExer01</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"><span class="comment">//完成代码</span></span><br><span class="line">System.out.println(<span class="string">&quot;书名\t作者\t价格\t销量\n三国\t罗贯中\t120\t1000&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//示意 =&gt; 可读性很好</span></span><br><span class="line"><span class="comment">//下面代码完成 两个数相加</span></span><br><span class="line"><span class="comment">//定义变量</span></span><br><span class="line"><span class="type">int</span> <span class="variable">n1</span> <span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"><span class="type">int</span> <span class="variable">n2</span> <span class="operator">=</span> <span class="number">30</span>;</span><br><span class="line"><span class="comment">//求和</span></span><br><span class="line"><span class="type">int</span> <span class="variable">sum</span> <span class="operator">=</span> n1 + n2;</span><br><span class="line"><span class="comment">//输出结果</span></span><br><span class="line">System.out.println(<span class="string">&quot;结果=&quot;</span> + sum);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><hr><h2 id="十三-易犯错误">十三. 易犯错误<a class="header-anchor" href="#十三-易犯错误"></a></h2><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081335827.png" alt="image-20220508133503644" style="zoom: 50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081336546.png" alt="image-20220508133644384" style="zoom:50%;" /></blockquote><hr><h2 id="十四-注释">十四. 注释<a class="header-anchor" href="#十四-注释"></a></h2><p><strong>注释(comment)</strong></p><ul class="lvl-0"><li class="lvl-2"><p>介绍:</p></li></ul><p>​用于注解说明解释程序的文字就是注释,注释提高了代码的阅读性(可读性);注释是<code>一个程序员必须要具有的良好编程习惯</code>。将自己的思想通过注释先整理出来,再用代码去体现。 [举例]</p><ul class="lvl-0"><li class="lvl-2"><p><strong><code>Java 中的注释类型</code></strong></p></li></ul><ol><li class="lvl-3"><p><code>单行注释 // </code></p></li><li class="lvl-3"><p><code>多行注释 /* */ </code></p></li><li class="lvl-3"><p><code>文档注释 /** */ </code></p></li></ol><ul class="lvl-0"><li class="lvl-2"><p><code>单行注释: </code></p></li></ul><p>基本格式</p><p>格式: //注释文字</p><ul class="lvl-0"><li class="lvl-2"><p><code>多行注释: </code></p></li></ul><p>基本格式</p><p>格式: /* 注释文字 */</p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//演示注释使用</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Comment01</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//单行注释</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//多行注释</span></span><br><span class="line"><span class="comment">/* 示意 =&gt; 可读性很好</span></span><br><span class="line"><span class="comment">下面代码完成 两个数相加</span></span><br><span class="line"><span class="comment">定义变量 </span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">注释</span></span><br><span class="line"><span class="comment">注释</span></span><br><span class="line"><span class="comment">int n1 = 10;... </span></span><br><span class="line"><span class="comment">System.out.println(&quot;ok~~&quot;);</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="type">int</span> <span class="variable">n1</span> <span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"><span class="type">int</span> <span class="variable">n2</span> <span class="operator">=</span> <span class="number">30</span>;</span><br><span class="line"><span class="comment">//求和</span></span><br><span class="line"><span class="type">int</span> <span class="variable">sum</span> <span class="operator">=</span> n1 + n2;</span><br><span class="line"><span class="comment">//输出结果</span></span><br><span class="line">System.out.println(<span class="string">&quot;结果=&quot;</span> + sum);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><ul class="lvl-0"><li class="lvl-2"><p>使用细节</p></li></ul><ol><li class="lvl-3"><p>被注释的文字,不会被 JVM(java 虚拟机)解释执行</p></li><li class="lvl-3"><p>多行注释里面不允许有多行注释嵌套</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p><code>文档注释:</code></p></li></ul><blockquote><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081402422.png" alt=""></p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 韩顺平</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Comment02</span> &#123; </span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081404635.png" alt="image-20220508140443548" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081405177.png" alt="image-20220508140522118" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081405617.png" alt="image-20220508140555554" style="zoom:50%;" /></blockquote><hr><ul class="lvl-0"><li class="lvl-2"><p><strong>javadoc 标签</strong></p></li></ul><p>javadoc 工具软件识别以下标签:</p><table><thead><tr><th>标签</th><th>描述</th><th>示例</th></tr></thead><tbody><tr><td>@author</td><td>标识一个类的作者</td><td>@author description</td></tr><tr><td>@deprecated</td><td>指名一个过期的类或成员</td><td>@deprecated description</td></tr><tr><td @docRoot=""></td><td>指明当前文档根目录的路径</td><td>Directory Path</td></tr><tr><td>@exception</td><td>标志一个类抛出的异常</td><td>@exception exception-name explanation</td></tr><tr><td @inheritDoc=""></td><td>从直接父类继承的注释</td><td>Inherits a comment from the immediate surperclass.</td></tr><tr @link="" name="" text=""><td @link=""></td><td>插入一个到另一个主题的链接</td><td></td></tr><tr><td @linkplain=""></td><td>插入一个到另一个主题的链接,但是该链接显示纯文本字体</td><td>Inserts an in-line link to another topic.</td></tr><tr><td>@param</td><td>说明一个方法的参数</td><td>@param parameter-name explanation</td></tr><tr><td>@return</td><td>说明返回值类型</td><td>@return explanation</td></tr><tr><td>@see</td><td>指定一个到另一个主题的链接</td><td>@see anchor</td></tr><tr><td>@serial</td><td>说明一个序列化属性</td><td>@serial description</td></tr><tr><td>@serialData</td><td>说明通过writeObject( ) 和 writeExternal( )方法写的数据</td><td>@serialData description</td></tr><tr><td>@serialField</td><td>说明一个ObjectStreamField组件</td><td>@serialField name type description</td></tr><tr><td>@since</td><td>标记当引入一个特定的变化时</td><td>@since release</td></tr><tr><td>@throws</td><td>和 @exception标签一样.</td><td>The @throws tag has the same meaning as the @exception tag.</td></tr><tr><td @value=""></td><td>显示常量的值,该常量必须是static属性。</td><td>Displays the value of a constant, which must be a static field.</td></tr><tr><td>@version</td><td>指定类的版本</td><td>@version info</td></tr></tbody></table><hr><ul class="lvl-0"><li class="lvl-2"><p>代码演示</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081414164.png" alt="image-20220508141428106" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081414376.png" alt="image-20220508141447322" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081415068.png" alt="image-20220508141519015" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081415355.png" alt="image-20220508141539312" style="zoom:50%;" /></blockquote><hr><h2 id="十五-代码规范">十五. 代码规范<a class="header-anchor" href="#十五-代码规范"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><code>Java 代码规范</code></p></li></ul><blockquote><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081416659.png" alt=""></p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081421585.png" alt="image-20220508142107515" style="zoom:50%;" /></blockquote><hr><h2 id="十六-DOS原理-路径-DOS指令">十六. DOS原理-路径-DOS指令<a class="header-anchor" href="#十六-DOS原理-路径-DOS指令"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>DOS 命令(了解)</p></li></ul><p>DOS 介绍</p><p>Dos: Disk Operating System 磁盘操作系统, 简单说一下 windows 的目录结构。[<strong>原理图</strong>]</p><blockquote><p><strong>原理图</strong></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081427390.png" alt=""></p></blockquote><ul class="lvl-0"><li class="lvl-2"><p>相关的知识补充: <strong><code>相对路径, 绝对路径</code></strong></p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081429068.png" alt="image-20220508142920905" style="zoom: 67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><strong><code>常用的</code></strong> <code>dos 命令 </code></p></li></ul><ol><li class="lvl-3"><p>查看<code>当前目录是有什么内容</code> dir</p></li></ol><p>​dir <code>dir d:\abc2\test200 </code></p><ol start="2"><li class="lvl-3"><p>切换到其他盘下:盘符号 cd : change directory</p></li></ol><p>​案例演示:切换到 c 盘 <code>cd /D c: </code></p><ol start="3"><li class="lvl-3"><p>切换到当前盘的其他目录下 (使用相对路径和绝对路径演示), …\表示上一级目录</p></li></ol><p>​案例演示: <code>cd d:\abc2\test200 </code>cd …\…\abc2\test200</p><ol start="4"><li class="lvl-3"><p>切换到上一级:</p></li></ol><p>​案例演示: <code>cd .. </code></p><ol start="5"><li class="lvl-3"><p>切换到根目录:<code>cd \ </code></p></li></ol><p>​案例演示:cd \</p><ol start="6"><li class="lvl-3"><p>查看指定的目录下所有的子级目录 <code>tree </code></p></li><li class="lvl-3"><p><code>清屏 cls</code></p></li><li class="lvl-3"><p>退出 DOS <code>exit </code></p></li><li class="lvl-3"><p>说明: <strong>因为小伙伴后面使用</strong> <strong>DOS</strong> <strong>非常少</strong>,所以对下面的几个指令,老韩给大家演示下, 大家了解即可 (<code>md[创建目录],rd[删除目录],copy[拷贝文件],del[删除文件],echo[输入内容到文件],type,move[剪切]</code>) =&gt; <strong>Linux</strong>,</p></li></ol><hr><h2 id="十七-本章作业">十七. 本章作业<a class="header-anchor" href="#十七-本章作业"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>本章作业</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081452380.png" alt="image-20220508145216238" style="zoom:50%;" /><hr><ul class="lvl-1"><li class="lvl-2"><p>1</p></li></ul></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Homework01</span> &#123; </span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"><span class="comment">//编写hello, world程序</span></span><br><span class="line">System.out.println(<span class="string">&quot;hello,world&quot;</span>); </span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><ul class="lvl-1"><li class="lvl-2"><p>2</p></li></ul></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//将个人的基本信息(姓名、性别、籍贯、住址)打印到控制台上输出。各条信息分别占一行</span></span><br><span class="line"><span class="comment">//</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Homework02</span> &#123; </span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"><span class="comment">//考察对转义字符</span></span><br><span class="line">System.out.println(<span class="string">&quot;姓名\t性别\t籍贯\t住址\n顺平\t男\t四川\t北京&quot;</span>); </span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><ul class="lvl-1"><li class="lvl-2"><p>3</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//JDK,JRE,JVM的关系</span></span><br><span class="line"><span class="comment">//</span></span><br><span class="line">答:</span><br><span class="line"><span class="number">1.</span> JDK = JRE + java开发工具</span><br><span class="line"><span class="number">2.</span> JRE = JVM + 核心类库</span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>4</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//环境变量path配置及其作用</span></span><br><span class="line"><span class="number">1.</span> 环境变量的作用是为了在 dos 的任意目录,可以去使用 java 和 javac 命令</span><br><span class="line"><span class="number">2.</span> 先配置 JAVA_HOME = 指向 jdk 安装的主目录</span><br><span class="line"><span class="number">3.</span> 编辑 path 环境变量,增加 %JAVA_HOME%\bin </span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>5</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//Java编写步骤</span></span><br><span class="line"><span class="number">1.</span> 编写java的源代码</span><br><span class="line"><span class="number">2.</span> javac 编译 ,得到对应的 .class 字节码文件</span><br><span class="line"><span class="number">3.</span> java 运行, 本质就是把 .class 加载到 jvm 运行</span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>6</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//Java编写7个规范</span></span><br><span class="line"><span class="number">1.</span> 类,方法的注释,使用javadoc的方式,即文档注释</span><br><span class="line"><span class="number">2.</span> 非javadoc注释,往往是对代码的说明(给程序的维护者),说明如何修改,注意事项</span><br><span class="line"><span class="number">3.</span> 使用tab ,整体将代码右移, 使用 shift+tab 整体左移</span><br><span class="line"><span class="number">4.</span> 运算符和 = 的两边,给空格,代码看上去清楚 <span class="type">int</span> <span class="variable">n</span> <span class="operator">=</span> <span class="number">1</span> + <span class="number">4</span>;</span><br><span class="line"><span class="number">5.</span> 源码文件使用 utf-<span class="number">8</span> 编码</span><br><span class="line"><span class="number">6.</span> 行宽字符不要超过 <span class="number">80</span></span><br><span class="line"><span class="number">7.</span> 代码编程风格有两种 次行风格,行尾风格(推荐)</span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>7</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//初学者java易犯错误 </span></span><br><span class="line"><span class="number">1.</span> 编译或者运行时,找不到文件 javac Hell0.java, 把文件名或者目录找对</span><br><span class="line"><span class="number">2.</span> 主类名和文件名不一致 , 修改时保持一致即可</span><br><span class="line"><span class="number">3.</span> 缺少;</span><br><span class="line"><span class="number">4.</span> 拼写错误,比如 <span class="number">1</span> -&gt; l <span class="number">0</span>-&gt;<span class="number">0</span>, <span class="keyword">void</span> -&gt; viod , 要求写代码时,一定要小心</span><br><span class="line"></span><br><span class="line">强调: 先思考-&gt;自己练习-&gt;看老师评讲</span><br><span class="line"></span><br></pre></td></tr></table></figure></blockquote><hr>]]></content>
1496
+ <content type="html"><![CDATA[<p><a href="https://www.bilibili.com/video/BV1fh411y7R8">视频链接:https://www.bilibili.com/video/BV1fh411y7R8</a></p><h2 id="一-就业方向">一. 就业方向<a class="header-anchor" href="#一-就业方向"></a></h2><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080320118.png" alt="image-20220508032024978" style="zoom:50%;" /><hr><h2 id="二-开发场景">二. 开发场景<a class="header-anchor" href="#二-开发场景"></a></h2><p>Java 开发场景举例 1-<code>SSM</code></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080322295.png" alt=""></p><p>Java 开发场景举例 2:<code>Android 核心代码</code></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080324796.png" alt=""></p><p>Java 开发场景举例 3:<code>大数据-hadoop </code></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080325177.png" alt=""></p><hr><h2 id="三-应用领域">三. 应用领域<a class="header-anchor" href="#三-应用领域"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>企业级应用</p></li></ul><p>主要指复杂的大企业的**<code>软件系统</code><strong>、各种类型的</strong><code>网站</code>**。应用领域包括金融、电信、交通、电子商务等。</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080327015.png" alt="image-20220508032702906" style="zoom:50%;" /><ul class="lvl-0"><li class="lvl-2"><p>Android 平台应用</p></li></ul><p>Android 应用程序使用 Java 语言编写。Android 开发水平的高低很大程度上取决于 Java 语言核心能力是否扎实。</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080327181.png" alt="image-20220508032750052" style="zoom:50%;" /><ul class="lvl-0"><li class="lvl-2"><p>移动领域应用</p></li></ul><p>主要表现在消费和嵌入式领域,是指在各种小型设备上的应用,包括机顶盒、车载的大屏影音娱乐设备、汽车通信设备、扫码的 POS 机等。</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080329788.png" alt="image-20220508032900704" style="zoom:50%;" /><hr><h2 id="四-程序举例">四. 程序举例<a class="header-anchor" href="#四-程序举例"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong>什么是程序</strong></p></li></ul><p>程序:计算机执行某些操作或解决某个问题而 <strong><code>编写的一系列有序指令的集合</code></strong></p><p>举例说明:</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080343728.png" alt="image-20220508034312623" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080343441.png" alt="image-20220508034326323" style="zoom: 67%;" /></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//老师写的最简单的程序,完成 1+1, 体会</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Test</span> &#123;</span><br><span class="line"> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"> <span class="type">int</span> <span class="variable">res</span> <span class="operator">=</span> <span class="number">1</span> + <span class="number">1</span>;</span><br><span class="line"> <span class="comment">// 显示</span></span><br><span class="line">System.out.print(<span class="string">&quot;结果=&quot;</span> + res);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080403773.png" alt=""></p><hr><h2 id="五-故事">五. 故事<a class="header-anchor" href="#五-故事"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>Java 诞生小故事</p></li></ul><ol><li class="lvl-3"><p><code>1995年 第1个版本</code></p></li><li class="lvl-3"><p><code>Java之父 gosling</code></p></li><li class="lvl-3"><p><code>最新版本:15</code></p></li><li class="lvl-3"><p><code>公司里用的最多的版本:8、11</code></p></li><li class="lvl-3"><p><code>Java 所有权:甲骨文</code></p></li></ol><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080344966.png" alt="image-20220508034456860" style="zoom: 67%;" /><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080408088.png" alt=""></p></blockquote><ul class="lvl-0"><li class="lvl-2"><p>Java 技术体系平台</p></li></ul><blockquote><p><code>标准版、企业版、小型版</code></p><p><code>Java SE、Java EE、Java ME</code></p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080412778.png" style="zoom:50%;" /></blockquote><hr><h2 id="六-特性">六. 特性<a class="header-anchor" href="#六-特性"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong>Java 重要特点</strong></p></li></ul><ol><li class="lvl-3"><p>Java 语言是面向对象的(<strong><code>oop</code></strong>)</p></li><li class="lvl-3"><p>Java <code>语言是健壮的</code>。Java 的强类型机制、异常处理、垃圾的自动收集等是 Java 程序健壮性的重要保证</p></li><li class="lvl-3"><p>Java 语言是**<code>跨平台性的</code>**。[即: <strong>一个编译好的.class 文件可以在多个系统下运行,这种特性称为跨平台</strong>]</p></li></ol><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080415181.png" style="zoom:50%;" /></blockquote><ol start="4"><li class="lvl-3"><p>Java 语言是解释型的[了解]</p></li></ol><p>​<strong>解释性语言:javascript,PHP, java 编译性语言: c / c++</strong></p><p>​区别是:<code>解释性语言</code>,编译后的代码,<code>不能直接被机器执行,需要解释器来执行</code>, <code>编译性语言</code>, 编译后的代码, 可以<code>直接被机器执行</code>, c /c++</p><hr><ul class="lvl-0"><li class="lvl-2"><p><strong>Java 的开发工具</strong></p><ul class="lvl-2"><li class="lvl-4"><p>工具选择</p><ul class="lvl-4"><li class="lvl-6"><p>如何选择开发工具</p><p>​我们先选择用文本编辑器本 sublime,到大家对 java 有一定了解后,我们再使用 IDEA 和 Eclipse 开发工具。</p></li><li class="lvl-6"><p>这是为什么呢</p><p>​更深刻的理解 java 技术,培养代码感。【面试时,往往程序员手写代码】</p><p>​有利于公司面试</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080421152.png" alt="image-20220508042124961" style="zoom:50%;" /></blockquote></li></ul></li></ul></li></ul><hr><h2 id="七-jdk介绍、安装、配置">七. jdk介绍、安装、配置<a class="header-anchor" href="#七-jdk介绍、安装、配置"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong>Java 运行机制及运行过程</strong></p><ul class="lvl-2"><li class="lvl-4"><p>Java 语言的特点:<code>跨平台性</code></p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080428588.png" alt="image-20220508042849189" style="zoom:50%;" /></blockquote></li><li class="lvl-4"><p>Java 核心机制-Java 虚拟机 [<code>JVM</code> java virtual machine]</p></li></ul></li><li class="lvl-2"><p><code>Java 核心机制-Java 虚拟机 [JVM java virtual machine]</code></p></li></ul><p><strong>基本介绍</strong></p><ol><li class="lvl-3"><p>JVM 是一个虚拟的计算机,具有指令集并使用不同的存储区域。负责执行指令,管理数据、内存、寄存器,包含在 <strong><code>JDK 中</code></strong>.</p></li><li class="lvl-3"><p>对于不同的平台,有不同的虚拟机。</p></li><li class="lvl-3"><p>Java 虚拟机机制屏蔽了底层运行平台的差别,实现了“一次**<code>编译</code><strong>,到处</strong><code>运行</code>**” [说明]</p></li></ol><p><strong>示意图</strong></p><blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//指令</span></span><br><span class="line">javac<span class="comment">// 编译</span></span><br><span class="line">java<span class="comment">// 运行</span></span><br></pre></td></tr></table></figure><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080434503.png" alt="image-20220508043429400" style="zoom: 67%;" /></blockquote><hr><p><strong><code>什么是 JDK,JRE</code></strong></p><ul class="lvl-0"><li class="lvl-2"><p><code>JDK 基本介绍 </code></p></li></ul><ol><li class="lvl-3"><p>JDK 的全称(Java Development Kit <strong><code>Java 开发工具包</code></strong>)</p></li></ol><p>​JDK = JRE + java 的开发工具 [java, javac,javadoc,javap 等]</p><ol start="2"><li class="lvl-3"><p>JDK 是提供给 Java 开发人员使用的,其中包含了 java 的开发工具,也包括了 JRE。所以安装了 JDK,就不用在单独安装 JRE 了。</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p><code>JRE 基本介绍</code></p></li></ul><ol><li class="lvl-3"><p>JRE(Java Runtime Environment <code> Java 运行环境</code>)</p></li></ol><p>​JRE = JVM + Java 的核心类库[类]</p><ol start="2"><li class="lvl-3"><p>包括 Java 虚拟机(JVM Java Virtual Machine)和 Java 程序所需的核心类库等,如果想要运行一个开发好的 Java 程序,计算机中只需要安装 JRE 即可。</p></li></ol><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080445424.png" style="zoom:67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><code>JDK、JRE 和 JVM 的包含关系</code></p></li></ul><ol><li class="lvl-3"><p><strong><code>JDK = JRE + 开发工具集</code></strong>(例如 Javac,java 编译工具等)</p></li><li class="lvl-3"><p><strong><code>JRE = JVM + Java SE</code></strong> <strong><code>标准类库</code></strong>(java 核心类库)</p></li><li class="lvl-3"><p>如果只想运行开发好的 .class 文件 只需要 JRE</p></li></ol><hr><p><strong>下载、安装 JDK</strong></p><blockquote><p><a href="https://www.oracle.com/java/technologies/downloads/">https://www.oracle.com/java/technologies/downloads/</a></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080450598.png" alt=""></p></blockquote><p><strong>配置环境变量 path</strong></p><ul class="lvl-0"><li class="lvl-2"><p>为什么要配置 path</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080507309.png" alt="image-20220508050732153" style="zoom:50%;" /></blockquote></li><li class="lvl-2"><p>配置环境变量 path 的步骤</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080512224.png" style="zoom:50%;" /></blockquote><hr><p>安装 JDK 的练习</p><blockquote><p>请同学们安装好 JDK,配置好 path 环境变量。可以在控制台下正确的执行, (10min)</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080520103.png" alt="image-20220508052000041" style="zoom:50%;" /><p>环境变量配置细节说明:</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080520181.png" alt="image-20220508052022102" style="zoom:50%;" /><hr><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080521628.png" alt="image-20220508052141440" style="zoom: 50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080528717.png" alt="image-20220508052824602" style="zoom:50%;" /><hr><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080529498.png" alt="image-20220508052931384" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080533822.png" alt="image-20220508053340793" style="zoom: 67%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080534562.png" alt="image-20220508053443524" style="zoom:67%;" /></blockquote><hr><h2 id="八-快速入门">八. 快速入门<a class="header-anchor" href="#八-快速入门"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>需求说明</p></li></ul><p>要求开发一个 Hello.java 程序,可以输出 “hello,world!”</p><ul class="lvl-0"><li class="lvl-2"><p>开发步骤</p></li></ul><ol><li class="lvl-3"><p>将 Java 代码编写到扩展名为 <code>Hello.java 的文件</code>中。[代码说明]</p></li><li class="lvl-3"><p>通过 <code>javac</code> 命令对该 java 文件进行<code>编译</code>,生成 <code>.class</code> 文件。</p></li><li class="lvl-3"><p>通过 <code>java</code> 命令对生成的 class 文件进行<code>运行</code>。</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p>运行原理示意图</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080545433.png" alt="image-20220508054554366" style="zoom: 67%;" /></blockquote><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080607424.png" alt="image-20220508060705278" style="zoom:50%;" /></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//这是java的快速入门, 演示java的开发步骤</span></span><br><span class="line"><span class="comment">//对代码的相关说明</span></span><br><span class="line"><span class="comment">//1. public class Hello 表示Hello是一个类,是一个public公有的类</span></span><br><span class="line"><span class="comment">//2. Hello&#123; &#125; 表示一个类的开始和结束</span></span><br><span class="line"><span class="comment">//3. public static void main(String[] args) 表示一个主方法,即我们程序的入口</span></span><br><span class="line"><span class="comment">//4. main() &#123;&#125; 表示方法的开始和结束</span></span><br><span class="line"><span class="comment">//5. System.out.println(&quot;hello,world~&quot;); 表示输出&quot;hello,world~&quot;到屏幕</span></span><br><span class="line"><span class="comment">//6. ;表示语句结束</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Hello</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;韩顺平教育 hello&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限。[演示]</span></span><br><span class="line"><span class="comment">//Dog 是一个类</span></span><br><span class="line"><span class="comment">//编译后,每一个类,都对于一个.class</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Dog</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限,也可以将main方法写在非public类中,</span></span><br><span class="line"><span class="comment">//然后指定运行非public 类,这样入口方法就是非public 的main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小狗狗~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Tiger</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小老虎~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080611636.png" alt="image-20220508061152606" style="zoom:67%;" /></blockquote><hr><h2 id="九-运行机制">九. 运行机制<a class="header-anchor" href="#九-运行机制"></a></h2><p><strong>Java 开发快速入门</strong></p><ul class="lvl-0"><li class="lvl-2"><p><code>Java执行流程分析</code></p></li></ul><blockquote><p>.java文件源文件</p><p>.class文件字节码文件</p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080612745.png" alt="image-20220508061231609" style="zoom: 67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><code>什么是编译</code></p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080619173.png" alt="image-20220508061953033" style="zoom: 67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><code>什么是运行</code></p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080623909.png" alt="image-20220508062339779" style="zoom:67%;" /></blockquote><hr><h2 id="十-开发细节">十. 开发细节<a class="header-anchor" href="#十-开发细节"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><strong><code>Java开发注意事项和细节说明</code></strong></p></li></ul><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080627135.png" alt="image-20220508062754938" style="zoom: 50%;" /><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Hello</span> &#123;</span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;韩顺平教育 hello&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限。[演示]</span></span><br><span class="line"><span class="comment">//Dog 是一个类</span></span><br><span class="line"><span class="comment">//编译后,每一个类,都对于一个.class</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Dog</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//一个源文件中最多只能有一个public类。其它类的个数不限,也可以将main方法写在非public类中,</span></span><br><span class="line"><span class="comment">//然后指定运行非public 类,这样入口方法就是非public 的main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小狗狗~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">Tiger</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">System.out.println(<span class="string">&quot;hello, 小老虎~&quot;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205080638351.png" alt="image-20220508063831299" style="zoom: 67%;" /></blockquote><hr><h2 id="十一-学习方法">十一. 学习方法<a class="header-anchor" href="#十一-学习方法"></a></h2><blockquote><ul class="lvl-1"><li class="lvl-2"><p>老韩聊: 如何快速掌握技术或知识点</p></li></ul><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081310765.png" alt="image-20220508131030628" style="zoom: 80%;" /></blockquote><hr><h2 id="十二-转义字符">十二. 转义字符<a class="header-anchor" href="#十二-转义字符"></a></h2><p><strong>Java 转义字符</strong></p><ul class="lvl-0"><li class="lvl-2"><p><code>Java 常用的转义字符</code></p></li></ul><p>在控制台,输入 tab 键,可以实现命令补全</p><ol><li class="lvl-3"><p><code>\t</code> :一个<code>制表位</code>,实现对齐的功能</p></li><li class="lvl-3"><p><code>\n</code> :<code>换行符</code></p></li><li class="lvl-3"><p><code>\\</code> :<code>一个\ </code></p></li><li class="lvl-3"><p><code>\&quot;</code> :<code>一个&quot; </code></p></li><li class="lvl-3"><p><code>\'</code> :<code>一个' </code></p></li><li class="lvl-3"><p><strong><code>\r</code></strong> :<strong><code>一个回车</code></strong> System.out.println(“韩顺平教育\r 北京”);</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p>说明</p></li></ul><p>应用实例</p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//演示转义字符的使用</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ChangeChar</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">// \t :一个制表位,实现对齐的功能</span></span><br><span class="line">System.out.println(<span class="string">&quot;北京\t天津\t上海&quot;</span>);</span><br><span class="line"><span class="comment">// \n :换行符</span></span><br><span class="line">System.out.println(<span class="string">&quot;jack\nsmith\nmary&quot;</span>);</span><br><span class="line"><span class="comment">// \\ :一个\ \\</span></span><br><span class="line">System.out.println(<span class="string">&quot;C:\\Windows\\System32\\cmd.exe&quot;</span>);</span><br><span class="line"><span class="comment">// \&quot; :一个&quot;</span></span><br><span class="line">System.out.println(<span class="string">&quot;老韩说:\&quot;要好好学习java,有前途\&quot;&quot;</span>);</span><br><span class="line"><span class="comment">// \&#x27; :一个&#x27;</span></span><br><span class="line">System.out.println(<span class="string">&quot;老韩说:\&#x27;要好好学习java,有前途\&#x27;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">// \r :一个回车 System.out.println(&quot;韩顺平教育\r北京&quot;);</span></span><br><span class="line"><span class="comment">// 解读</span></span><br><span class="line"><span class="comment">// 1. 输出 韩顺平教育</span></span><br><span class="line"><span class="comment">// 2. \r表示回车 </span></span><br><span class="line">System.out.println(<span class="string">&quot;韩顺平教育\r北京&quot;</span>); <span class="comment">// 北京平教育</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081323663.png" alt="image-20220508132315623" style="zoom: 67%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081327844.png" alt="image-20220508132732792" style="zoom: 67%;" /><hr><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081328387.png" alt="image-20220508132852344" style="zoom:67%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081329085.png" alt="image-20220508132927045" style="zoom:67%;" /></blockquote><hr><ul class="lvl-0"><li class="lvl-2"><p>课堂练习</p></li></ul><p>要求:请使用一句输出语句,达到输入如下图形的效果 2min</p><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081331278.png" alt="image-20220508133105218" style="zoom:67%;" /></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">ChangeCharExer01</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"><span class="comment">//完成代码</span></span><br><span class="line">System.out.println(<span class="string">&quot;书名\t作者\t价格\t销量\n三国\t罗贯中\t120\t1000&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//示意 =&gt; 可读性很好</span></span><br><span class="line"><span class="comment">//下面代码完成 两个数相加</span></span><br><span class="line"><span class="comment">//定义变量</span></span><br><span class="line"><span class="type">int</span> <span class="variable">n1</span> <span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"><span class="type">int</span> <span class="variable">n2</span> <span class="operator">=</span> <span class="number">30</span>;</span><br><span class="line"><span class="comment">//求和</span></span><br><span class="line"><span class="type">int</span> <span class="variable">sum</span> <span class="operator">=</span> n1 + n2;</span><br><span class="line"><span class="comment">//输出结果</span></span><br><span class="line">System.out.println(<span class="string">&quot;结果=&quot;</span> + sum);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><hr><h2 id="十三-易犯错误">十三. 易犯错误<a class="header-anchor" href="#十三-易犯错误"></a></h2><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081335827.png" alt="image-20220508133503644" style="zoom: 50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081336546.png" alt="image-20220508133644384" style="zoom:50%;" /></blockquote><hr><h2 id="十四-注释">十四. 注释<a class="header-anchor" href="#十四-注释"></a></h2><p><strong>注释(comment)</strong></p><ul class="lvl-0"><li class="lvl-2"><p>介绍:</p></li></ul><p>​用于注解说明解释程序的文字就是注释,注释提高了代码的阅读性(可读性);注释是<code>一个程序员必须要具有的良好编程习惯</code>。将自己的思想通过注释先整理出来,再用代码去体现。 [举例]</p><ul class="lvl-0"><li class="lvl-2"><p><strong><code>Java 中的注释类型</code></strong></p></li></ul><ol><li class="lvl-3"><p><code>单行注释 // </code></p></li><li class="lvl-3"><p><code>多行注释 /* */ </code></p></li><li class="lvl-3"><p><code>文档注释 /** */ </code></p></li></ol><ul class="lvl-0"><li class="lvl-2"><p><code>单行注释: </code></p></li></ul><p>基本格式</p><p>格式: //注释文字</p><ul class="lvl-0"><li class="lvl-2"><p><code>多行注释: </code></p></li></ul><p>基本格式</p><p>格式: /* 注释文字 */</p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//演示注释使用</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Comment01</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"></span><br><span class="line"><span class="comment">//单行注释</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//多行注释</span></span><br><span class="line"><span class="comment">/* 示意 =&gt; 可读性很好</span></span><br><span class="line"><span class="comment">下面代码完成 两个数相加</span></span><br><span class="line"><span class="comment">定义变量 </span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">注释</span></span><br><span class="line"><span class="comment">注释</span></span><br><span class="line"><span class="comment">int n1 = 10;... </span></span><br><span class="line"><span class="comment">System.out.println(&quot;ok~~&quot;);</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="type">int</span> <span class="variable">n1</span> <span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"><span class="type">int</span> <span class="variable">n2</span> <span class="operator">=</span> <span class="number">30</span>;</span><br><span class="line"><span class="comment">//求和</span></span><br><span class="line"><span class="type">int</span> <span class="variable">sum</span> <span class="operator">=</span> n1 + n2;</span><br><span class="line"><span class="comment">//输出结果</span></span><br><span class="line">System.out.println(<span class="string">&quot;结果=&quot;</span> + sum);</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><ul class="lvl-0"><li class="lvl-2"><p>使用细节</p></li></ul><ol><li class="lvl-3"><p>被注释的文字,不会被 JVM(java 虚拟机)解释执行</p></li><li class="lvl-3"><p>多行注释里面不允许有多行注释嵌套</p></li></ol><ul class="lvl-0"><li class="lvl-2"><p><code>文档注释:</code></p></li></ul><blockquote><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081402422.png" alt=""></p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> 韩顺平</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@version</span> 1.0</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Comment02</span> &#123; </span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081404635.png" alt="image-20220508140443548" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081405177.png" alt="image-20220508140522118" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081405617.png" alt="image-20220508140555554" style="zoom:50%;" /></blockquote><hr><ul class="lvl-0"><li class="lvl-2"><p><strong>javadoc 标签</strong></p></li></ul><p>javadoc 工具软件识别以下标签:</p><table><thead><tr><th>标签</th><th>描述</th><th>示例</th></tr></thead><tbody><tr><td>@author</td><td>标识一个类的作者</td><td>@author description</td></tr><tr><td>@deprecated</td><td>指名一个过期的类或成员</td><td>@deprecated description</td></tr><tr><td @docRoot=""></td><td>指明当前文档根目录的路径</td><td>Directory Path</td></tr><tr><td>@exception</td><td>标志一个类抛出的异常</td><td>@exception exception-name explanation</td></tr><tr><td @inheritDoc=""></td><td>从直接父类继承的注释</td><td>Inherits a comment from the immediate surperclass.</td></tr><tr @link="" name="" text=""><td @link=""></td><td>插入一个到另一个主题的链接</td><td></td></tr><tr><td @linkplain=""></td><td>插入一个到另一个主题的链接,但是该链接显示纯文本字体</td><td>Inserts an in-line link to another topic.</td></tr><tr><td>@param</td><td>说明一个方法的参数</td><td>@param parameter-name explanation</td></tr><tr><td>@return</td><td>说明返回值类型</td><td>@return explanation</td></tr><tr><td>@see</td><td>指定一个到另一个主题的链接</td><td>@see anchor</td></tr><tr><td>@serial</td><td>说明一个序列化属性</td><td>@serial description</td></tr><tr><td>@serialData</td><td>说明通过writeObject( ) 和 writeExternal( )方法写的数据</td><td>@serialData description</td></tr><tr><td>@serialField</td><td>说明一个ObjectStreamField组件</td><td>@serialField name type description</td></tr><tr><td>@since</td><td>标记当引入一个特定的变化时</td><td>@since release</td></tr><tr><td>@throws</td><td>和 @exception标签一样.</td><td>The @throws tag has the same meaning as the @exception tag.</td></tr><tr><td @value=""></td><td>显示常量的值,该常量必须是static属性。</td><td>Displays the value of a constant, which must be a static field.</td></tr><tr><td>@version</td><td>指定类的版本</td><td>@version info</td></tr></tbody></table><hr><ul class="lvl-0"><li class="lvl-2"><p>代码演示</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081414164.png" alt="image-20220508141428106" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081414376.png" alt="image-20220508141447322" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081415068.png" alt="image-20220508141519015" style="zoom:50%;" /><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081415355.png" alt="image-20220508141539312" style="zoom:50%;" /></blockquote><hr><h2 id="十五-代码规范">十五. 代码规范<a class="header-anchor" href="#十五-代码规范"></a></h2><ul class="lvl-0"><li class="lvl-2"><p><code>Java 代码规范</code></p></li></ul><blockquote><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081416659.png" alt=""></p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081421585.png" alt="image-20220508142107515" style="zoom:50%;" /></blockquote><hr><h2 id="十六-DOS原理-路径-DOS指令">十六. DOS原理-路径-DOS指令<a class="header-anchor" href="#十六-DOS原理-路径-DOS指令"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>DOS 命令(了解)</p></li></ul><p>DOS 介绍</p><p>Dos: Disk Operating System 磁盘操作系统, 简单说一下 windows 的目录结构。[<strong>原理图</strong>]</p><blockquote><p><strong>原理图</strong></p><p><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081427390.png" alt=""></p></blockquote><ul class="lvl-0"><li class="lvl-2"><p>相关的知识补充: <strong><code>相对路径, 绝对路径</code></strong></p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081429068.png" alt="image-20220508142920905" style="zoom: 67%;" /></blockquote><ul class="lvl-0"><li class="lvl-2"><p><strong><code>常用的</code></strong> <code>dos 命令 </code></p></li></ul><ol><li class="lvl-3"><p>查看<code>当前目录是有什么内容</code> dir</p></li></ol><p>​dir <code>dir d:\abc2\test200 </code></p><ol start="2"><li class="lvl-3"><p>切换到其他盘下:盘符号 cd : change directory</p></li></ol><p>​案例演示:切换到 c 盘 <code>cd /D c: </code></p><ol start="3"><li class="lvl-3"><p>切换到当前盘的其他目录下 (使用相对路径和绝对路径演示), …\表示上一级目录</p></li></ol><p>​案例演示: <code>cd d:\abc2\test200 </code>cd …\…\abc2\test200</p><ol start="4"><li class="lvl-3"><p>切换到上一级:</p></li></ol><p>​案例演示: <code>cd .. </code></p><ol start="5"><li class="lvl-3"><p>切换到根目录:<code>cd \ </code></p></li></ol><p>​案例演示:cd \</p><ol start="6"><li class="lvl-3"><p>查看指定的目录下所有的子级目录 <code>tree </code></p></li><li class="lvl-3"><p><code>清屏 cls</code></p></li><li class="lvl-3"><p>退出 DOS <code>exit </code></p></li><li class="lvl-3"><p>说明: <strong>因为小伙伴后面使用</strong> <strong>DOS</strong> <strong>非常少</strong>,所以对下面的几个指令,老韩给大家演示下, 大家了解即可 (<code>md[创建目录],rd[删除目录],copy[拷贝文件],del[删除文件],echo[输入内容到文件],type,move[剪切]</code>) =&gt; <strong>Linux</strong>,</p></li></ol><hr><h2 id="十七-本章作业">十七. 本章作业<a class="header-anchor" href="#十七-本章作业"></a></h2><ul class="lvl-0"><li class="lvl-2"><p>本章作业</p></li></ul><blockquote><img src="https://registry.npmmirror.com/mycpen-image-bed/0.0.0-2022/files/image/202205081452380.png" alt="image-20220508145216238" style="zoom:50%;" /><hr><ul class="lvl-1"><li class="lvl-2"><p>1</p></li></ul></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Homework01</span> &#123; </span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"><span class="comment">//编写hello, world程序</span></span><br><span class="line">System.out.println(<span class="string">&quot;hello,world&quot;</span>); </span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><ul class="lvl-1"><li class="lvl-2"><p>2</p></li></ul></blockquote><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//将个人的基本信息(姓名、性别、籍贯、住址)打印到控制台上输出。各条信息分别占一行</span></span><br><span class="line"><span class="comment">//</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">Homework02</span> &#123; </span><br><span class="line"></span><br><span class="line"><span class="comment">//编写一个main方法</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line"><span class="comment">//考察对转义字符</span></span><br><span class="line">System.out.println(<span class="string">&quot;姓名\t性别\t籍贯\t住址\n顺平\t男\t四川\t北京&quot;</span>); </span><br><span class="line">&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><blockquote><ul class="lvl-1"><li class="lvl-2"><p>3</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//JDK,JRE,JVM的关系</span></span><br><span class="line"><span class="comment">//</span></span><br><span class="line">答:</span><br><span class="line"><span class="number">1.</span> JDK = JRE + java开发工具</span><br><span class="line"><span class="number">2.</span> JRE = JVM + 核心类库</span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>4</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//环境变量path配置及其作用</span></span><br><span class="line"><span class="number">1.</span> 环境变量的作用是为了在 dos 的任意目录,可以去使用 java 和 javac 命令</span><br><span class="line"><span class="number">2.</span> 先配置 JAVA_HOME = 指向 jdk 安装的主目录</span><br><span class="line"><span class="number">3.</span> 编辑 path 环境变量,增加 %JAVA_HOME%\bin </span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>5</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//Java编写步骤</span></span><br><span class="line"><span class="number">1.</span> 编写java的源代码</span><br><span class="line"><span class="number">2.</span> javac 编译 ,得到对应的 .class 字节码文件</span><br><span class="line"><span class="number">3.</span> java 运行, 本质就是把 .class 加载到 jvm 运行</span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>6</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//Java编写7个规范</span></span><br><span class="line"><span class="number">1.</span> 类,方法的注释,使用javadoc的方式,即文档注释</span><br><span class="line"><span class="number">2.</span> 非javadoc注释,往往是对代码的说明(给程序的维护者),说明如何修改,注意事项</span><br><span class="line"><span class="number">3.</span> 使用tab ,整体将代码右移, 使用 shift+tab 整体左移</span><br><span class="line"><span class="number">4.</span> 运算符和 = 的两边,给空格,代码看上去清楚 <span class="type">int</span> <span class="variable">n</span> <span class="operator">=</span> <span class="number">1</span> + <span class="number">4</span>;</span><br><span class="line"><span class="number">5.</span> 源码文件使用 utf-<span class="number">8</span> 编码</span><br><span class="line"><span class="number">6.</span> 行宽字符不要超过 <span class="number">80</span></span><br><span class="line"><span class="number">7.</span> 代码编程风格有两种 次行风格,行尾风格(推荐)</span><br></pre></td></tr></table></figure><ul class="lvl-1"><li class="lvl-2"><p>7</p></li></ul><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//初学者java易犯错误 </span></span><br><span class="line"><span class="number">1.</span> 编译或者运行时,找不到文件 javac Hell0.java, 把文件名或者目录找对</span><br><span class="line"><span class="number">2.</span> 主类名和文件名不一致 , 修改时保持一致即可</span><br><span class="line"><span class="number">3.</span> 缺少;</span><br><span class="line"><span class="number">4.</span> 拼写错误,比如 <span class="number">1</span> -&gt; l <span class="number">0</span>-&gt;<span class="number">0</span>, <span class="keyword">void</span> -&gt; viod , 要求写代码时,一定要小心</span><br><span class="line"></span><br><span class="line">强调: 先思考-&gt;自己练习-&gt;看老师评讲</span><br><span class="line"></span><br></pre></td></tr></table></figure></blockquote><hr>]]></content>
1497
1497
 
1498
1498
 
1499
1499
  <categories>