-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJava-4流程控制.html
90 lines (69 loc) · 61 KB
/
Java-4流程控制.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!doctype html>
<html lang="zh"><head><meta charset="utf-8"><meta name="generator" content="Hexo 4.2.1"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta><title>Java-4流程控制 - 蒋志伟的个人网站</title><meta description="流程控制:程序需要根据不同的条件去进行不同的流程处理,在程序中我们称之为流程控制。举例:用户输入4位卡号,每位数字之和大于20,中奖,小于20则不中奖。 if语法:if(判断条件){ &#x2F;&#x2F;条件成立}else{ &#x2F;&#x2F;条件不成立} if-esle是Java中最基本的流程控制语句if后面必须跟(条件)else后面不能有(),可以直接跟{}也可以再跟一个if()else{}可以继续嵌套if语句"><meta property="og:type" content="blog"><meta property="og:title" content="Java-4流程控制"><meta property="og:url" content="https://jiangzhiwei.cn/Java-4%E6%B5%81%E7%A8%8B%E6%8E%A7%E5%88%B6.html"><meta property="og:site_name" content="蒋志伟的个人网站"><meta property="og:description" content="流程控制:程序需要根据不同的条件去进行不同的流程处理,在程序中我们称之为流程控制。举例:用户输入4位卡号,每位数字之和大于20,中奖,小于20则不中奖。 if语法:if(判断条件){ &#x2F;&#x2F;条件成立}else{ &#x2F;&#x2F;条件不成立} if-esle是Java中最基本的流程控制语句if后面必须跟(条件)else后面不能有(),可以直接跟{}也可以再跟一个if()else{}可以继续嵌套if语句"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://jiangzhiwei.cn/img/og_image.png"><meta property="article:published_time" content="2019-06-01T13:30:20.000Z"><meta property="article:modified_time" content="2020-06-01T16:16:16.450Z"><meta property="article:author" content="蒋志伟"><meta property="article:tag" content="Java"><meta property="twitter:card" content="summary"><meta property="twitter:image" content="/img/og_image.png"><script type="application/ld+json">{"@context":"https://schema.org","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"https://jiangzhiwei.cn/Java-4%E6%B5%81%E7%A8%8B%E6%8E%A7%E5%88%B6.html"},"headline":"蒋志伟的个人网站","image":["https://jiangzhiwei.cn/img/og_image.png"],"datePublished":"2019-06-01T13:30:20.000Z","dateModified":"2020-06-01T16:16:16.450Z","author":{"@type":"Person","name":"蒋志伟"},"description":"流程控制:程序需要根据不同的条件去进行不同的流程处理,在程序中我们称之为流程控制。举例:用户输入4位卡号,每位数字之和大于20,中奖,小于20则不中奖。 if语法:if(判断条件){ //条件成立}else{ //条件不成立} if-esle是Java中最基本的流程控制语句if后面必须跟(条件)else后面不能有(),可以直接跟{}也可以再跟一个if()else{}可以继续嵌套if语句"}</script><link rel="canonical" href="https://jiangzhiwei.cn/Java-4%E6%B5%81%E7%A8%8B%E6%8E%A7%E5%88%B6.html"><link rel="alternative" href="/atom.xml" title="蒋志伟的个人网站" type="application/atom+xml"><link rel="icon" href="/img/myAvatar.jpg"><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/styles/atom-one-light.css"><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;600&family=Source+Code+Pro"><link rel="stylesheet" href="/css/default.css"><style>body>.footer,body>.navbar,body>.section{opacity:0}</style><!--!--><script>var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?31552f1ad96cfce8fc7598674de198b0";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script><script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" defer></script><!--!--><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/lightgallery.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/justifiedGallery.min.css"><!--!--><!--!--><script src="https://cdn.jsdelivr.net/npm/[email protected]/pace.min.js"></script></head><body class="is-2-column"><nav class="navbar navbar-main"><div class="container"><div class="navbar-brand justify-content-center"><a class="navbar-item navbar-logo" href="/"><img src="/img/myAvatar.jpg" alt="蒋志伟的个人网站" height="28"></a></div><div class="navbar-menu"><div class="navbar-start"><a class="navbar-item" href="/">主页</a><a class="navbar-item" href="/archives">归档</a><a class="navbar-item" href="/categories">分类</a><a class="navbar-item" href="/tags">标签</a><a class="navbar-item" href="/about">关于</a></div><div class="navbar-end"><a class="navbar-item" target="_blank" rel="noopener" title="Download on GitHub" href="https://github.com/jzwnju"><i class="fab fa-github"></i></a><a class="navbar-item search" title="搜索" href="javascript:;"><i class="fas fa-search"></i></a></div></div></div></nav><section class="section"><div class="container"><div class="columns"><div class="column order-2 column-main is-8-tablet is-8-desktop is-8-widescreen"><div class="card"><article class="card-content article" role="article"><div class="article-meta size-small is-uppercase level is-mobile"><div class="level-left"><time class="level-item" dateTime="2019-06-01T13:30:20.000Z" title="2019-06-01T13:30:20.000Z">2019-06-01</time><span class="level-item"><a class="link-muted" href="/categories/%E5%90%8E%E7%AB%AF/">后端</a></span><span class="level-item">12 分钟 读完 (大约 1726 个字)</span><span class="level-item" id="busuanzi_container_page_pv"><i class="far fa-eye"></i> <span id="busuanzi_value_page_pv">0</span>次访问</span></div></div><h1 class="title is-3 is-size-4-mobile">Java-4流程控制</h1><div class="content"><h2 id="流程控制:"><a href="#流程控制:" class="headerlink" title="流程控制:"></a>流程控制:</h2><p>程序需要根据不同的条件去进行不同的流程处理,在程序中我们称之为流程控制。<br>举例:用户输入4位卡号,每位数字之和大于20,中奖,小于20则不中奖。</p>
<h3 id="if"><a href="#if" class="headerlink" title="if"></a>if</h3><p>语法:<br>if(判断条件){<br> //条件成立<br>}else{<br> //条件不成立<br>}</p>
<p>if-esle是Java中最基本的流程控制语句<br>if后面必须跟(条件)<br>else后面不能有(),可以直接跟{}<br>也可以再跟一个if()<br>else{}可以继续嵌套if语句</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></pre></td><td class="code"><pre><span class="line"><span class="comment">// 学校举办运动会,百米赛跑成绩13秒以内有资格进入决赛,根据性别分别进入男子组和女子组。</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test3</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> System.out.println(<span class="string">"请输入张三的百米成绩"</span>);</span><br><span class="line"> Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line"> <span class="keyword">int</span> score = scanner.nextInt();</span><br><span class="line"> System.out.println(<span class="string">"请输入张三的性别"</span>);</span><br><span class="line"> String gender = scanner.next();</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span>(score<<span class="number">13</span>) {</span><br><span class="line"> <span class="keyword">if</span>(gender.equals(<span class="string">"男"</span>)) {</span><br><span class="line"> System.out.println(<span class="string">"进入男子组"</span>);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> System.out.println(<span class="string">"进入女子组"</span>);</span><br><span class="line"> }</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> System.out.println(<span class="string">"很遗憾,你被淘汰了!!!"</span>);</span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>String类型的值比较是否相等<br>不能用 ==<br>应该用equals方法进行判断</p>
<h3 id="switch-case"><a href="#switch-case" class="headerlink" title="switch case"></a>switch case</h3><p>语法:<br>switch(要判断的变量){<br> case 特定值1:<br> //<br> case 特定值2:<br> //<br> …<br>}<br>switch-case和if-else的区别是<br>switch-case只能处理等值判断,不能处理大于/小于判断<br>if-else任何判断都可以处理</p>
<p>如果变量满足某个case语句,<br>则会执行该语句的逻辑代码,同时<br>该case之后的所有case不再做判断,<br>统一认为全部满足,逻辑代码都会执行。</p>
<p>如何解决:<br>在每一个case的逻辑代码结束之后,添加break;</p>
<p>switch支持的数据类型:<br>int,short,byte,char<br>枚举类型,String类型 (jdk1.7之后的版本支持)</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></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test4</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> System.out.println(<span class="string">"请输入一个数字"</span>);</span><br><span class="line"> Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line"> String str = <span class="string">""</span>;</span><br><span class="line"> <span class="keyword">switch</span>(str) {</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"1"</span>:</span><br><span class="line"> System.out.println(<span class="string">"中了一个三等奖"</span>);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"20"</span>:</span><br><span class="line"> System.out.println(<span class="string">"中了二等奖"</span>);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="string">"30"</span>:</span><br><span class="line"> System.out.println(<span class="string">"中了一等奖"</span>);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">default</span>:</span><br><span class="line"> System.out.println(<span class="string">"很遗憾,您没有中奖!"</span>);</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h2 id="循环"><a href="#循环" class="headerlink" title="循环"></a>循环</h2><p>for<br>foreach:增强型for循环<br>while<br>do-while</p>
<h3 id="语法:"><a href="#语法:" class="headerlink" title="语法:"></a>语法:</h3><p>for:<br>for(初始化循环变量;循环条件;更新循环变量){<br> 循环体;<br>}</p>
<p>while:<br>初始化循环变量;<br>while(循环条件){<br> 循环体;<br> 更新循环变量;<br>}</p>
<p>do-while:<br>初始化循环变量;<br>do{<br> 循环体;<br> 更新循环变量;<br>}while(循环条件);</p>
<h3 id="while和do-while的区别"><a href="#while和do-while的区别" class="headerlink" title="while和do-while的区别"></a>while和do-while的区别</h3><p>while循环先判断,再执行。<br>do-while先执行,再判断。<br>while有可能一次都不执行。<br>do-while至少会执行一次。</p>
<h3 id="for循环和while(do-while)的区别:"><a href="#for循环和while(do-while)的区别:" class="headerlink" title="for循环和while(do-while)的区别:"></a>for循环和while(do-while)的区别:</h3><p>for适用于次数确定的循环<br>while,do-while适用于次数不确定的循环</p>
<h3 id="循环四要素:"><a href="#循环四要素:" class="headerlink" title="循环四要素:"></a>循环四要素:</h3><p>1.初始化循环变量;<br>2.循环条件;<br>3.迭代:更新循环变量;<br>4.循环体;</p>
<p>首先执行初始化循环变量,只执行一次。<br>判断循环条件是否成立,如果成立,执行循环体,<br>如果不成立,进行下一次循环,多次执行。<br>更新循环变量,多次执行。<br>循环体,多次执行</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></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test5</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">1</span>;i <= <span class="number">10000</span>;i++) {</span><br><span class="line"> System.out.println(i+<span class="string">":Hello World"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h2 id="🌰"><a href="#🌰" class="headerlink" title="🌰"></a>🌰</h2><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><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 1.循环输入张三考试的五门成绩,分别打印输出,并且计算平均分。</span></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line"> <span class="keyword">float</span> score1 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score2 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score3 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score4 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score5 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">1</span>; i <= <span class="number">5</span>; i++) {</span><br><span class="line"> System.out.print(<span class="string">"请输入张三的第"</span>+i+<span class="string">"门成绩:"</span>);</span><br><span class="line"> <span class="keyword">switch</span>(i) {</span><br><span class="line"> <span class="keyword">case</span> <span class="number">1</span>:</span><br><span class="line"> score1 = scanner.nextFloat();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">2</span>:</span><br><span class="line"> score2 = scanner.nextFloat();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">3</span>:</span><br><span class="line"> score3 = scanner.nextFloat();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">4</span>:</span><br><span class="line"> score4 = scanner.nextFloat();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">5</span>:</span><br><span class="line"> score5 = scanner.nextFloat();</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"张三的第1门成绩:"</span>+score1);</span><br><span class="line"> System.out.println(<span class="string">"张三的第2门成绩:"</span>+score2);</span><br><span class="line"> System.out.println(<span class="string">"张三的第3门成绩:"</span>+score3);</span><br><span class="line"> System.out.println(<span class="string">"张三的第4门成绩:"</span>+score4);</span><br><span class="line"> System.out.println(<span class="string">"张三的第5门成绩:"</span>+score5);</span><br><span class="line"> System.out.println(<span class="string">"张三的平均成绩是"</span>+(score1+score2+score3+score4+score5)/<span class="number">5</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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></pre></td><td class="code"><pre><span class="line"><span class="comment">// 2.任意输入一个整数:6</span></span><br><span class="line"><span class="comment">// 打印如下的加法表:</span></span><br><span class="line"><span class="comment">// 0 + 6 = 6</span></span><br><span class="line"><span class="comment">// 1 + 5 = 6</span></span><br><span class="line"><span class="comment">// 2 + 4 = 6</span></span><br><span class="line"><span class="comment">// 3 + 3 = 6</span></span><br><span class="line"><span class="comment">// 4 + 2 = 6</span></span><br><span class="line"><span class="comment">// 5 + 1 = 6</span></span><br><span class="line"><span class="comment">// 6 + 0 = 6</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test4</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> System.out.print(<span class="string">"请输入一个整数:"</span>);</span><br><span class="line"> Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line"> <span class="keyword">int</span> num = scanner.nextInt();</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span>; i < num+<span class="number">1</span>; i++) {</span><br><span class="line"> System.out.println(i + <span class="string">"+"</span> + (num-i) + <span class="string">"="</span> + num);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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="comment">// 3.打印:如下图形</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><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test7</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">0</span>; j < <span class="number">5</span>; j++) {</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span>; i < <span class="number">4</span> - j; i++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println(<span class="string">"*****"</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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">// 4.打印如下图形</span></span><br><span class="line"><span class="comment">// i 空格 *</span></span><br><span class="line"><span class="comment">// * 0 4 1 </span></span><br><span class="line"><span class="comment">// *** 1 3 3</span></span><br><span class="line"><span class="comment">// ***** 2 2 5</span></span><br><span class="line"><span class="comment">// ******* 3 1 7</span></span><br><span class="line"><span class="comment">// ********* 4 0 9</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test8</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ;i < <span class="number">5</span>; i++) {</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">0</span>; j < <span class="number">4</span>-i; j++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//输出*</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">0</span>; k < <span class="number">2</span>*i+<span class="number">1</span>; k++) {</span><br><span class="line"> System.out.print(<span class="string">"*"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">0</span>; j < <span class="number">4</span>-i; j++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 5.打印如下图形</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">// ******* </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><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test9</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> <span class="comment">//上半部分</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ;i < <span class="number">5</span>; i++) {</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">0</span>; j < <span class="number">4</span>-i; j++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//输出*</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">0</span>; k < <span class="number">2</span>*i+<span class="number">1</span>; k++) {</span><br><span class="line"> System.out.print(<span class="string">"*"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">0</span>; j < <span class="number">4</span>-i; j++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"> </span><br><span class="line"> <span class="comment">//下半部分</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ;i < <span class="number">4</span>; i++) {</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">0</span>; j < i+<span class="number">1</span>; j++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//输出*</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> k = <span class="number">0</span>; k < <span class="number">7</span>-<span class="number">2</span>*i; k++) {</span><br><span class="line"> System.out.print(<span class="string">"*"</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="comment">//输出空格</span></span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> m = <span class="number">0</span>; m < i+<span class="number">1</span>; m++) {</span><br><span class="line"> System.out.print(<span class="string">" "</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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></pre></td><td class="code"><pre><span class="line"><span class="comment">// 6.输出9*9乘法口诀表</span></span><br><span class="line"><span class="comment">// 1*1 = 1</span></span><br><span class="line"><span class="comment">// 2*1 = 2 2*2 = 4</span></span><br><span class="line"><span class="comment">// 3*1 = 3 3*2 = 6 3*3 = 9</span></span><br><span class="line"><span class="comment">// ...</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test10</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">1</span>; i <= <span class="number">9</span>; i++) {</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> j = <span class="number">1</span>; j <= i; j++) {</span><br><span class="line"> System.out.print(i+<span class="string">" * "</span>+j+<span class="string">" = "</span>+i*j+<span class="string">"\t"</span>);</span><br><span class="line"> }</span><br><span class="line"> System.out.println();</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 7.循环输入张三考试的五门成绩,分别打印输出,并且计算平均分,如果操作不当,输入了负数,停止录入并提示错误。</span></span><br><span class="line"><span class="keyword">import</span> java.util.Scanner;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test11</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> Scanner scanner = <span class="keyword">new</span> Scanner(System.in);</span><br><span class="line"> <span class="keyword">float</span> score1 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score2 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score3 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score4 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="keyword">float</span> score5 = <span class="number">0.0f</span>;</span><br><span class="line"> <span class="comment">//用户是否输入了负数</span></span><br><span class="line"> <span class="keyword">boolean</span> flag = <span class="keyword">false</span>;</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">1</span>; i <= <span class="number">5</span>; i++) {</span><br><span class="line"> System.out.print(<span class="string">"请输入张三的第"</span>+i+<span class="string">"门成绩:"</span>);</span><br><span class="line"> <span class="keyword">float</span> score = scanner.nextFloat();</span><br><span class="line"> <span class="comment">//如果输入的成绩<0,则跳出循环</span></span><br><span class="line"> <span class="keyword">if</span>(score < <span class="number">0</span>) {</span><br><span class="line"> flag = <span class="keyword">true</span>;</span><br><span class="line"> <span class="comment">// 当程序执行break时,直接停止当前循环,break之后的代码,不再执行;同时跳出整个循环体,不再执行后续的循环。</span></span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">switch</span>(i) {</span><br><span class="line"> <span class="keyword">case</span> <span class="number">1</span>:</span><br><span class="line"> score1 = score;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">2</span>:</span><br><span class="line"> score2 = score;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">3</span>:</span><br><span class="line"> score3 = score;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">4</span>:</span><br><span class="line"> score4 = score;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> <span class="keyword">case</span> <span class="number">5</span>:</span><br><span class="line"> score5 = score;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span>(flag) {</span><br><span class="line"> System.out.println(<span class="string">"您输入有误!请重新输入"</span>);</span><br><span class="line"> }<span class="keyword">else</span> {</span><br><span class="line"> System.out.println(<span class="string">"张三的第1门成绩:"</span>+score1);</span><br><span class="line"> System.out.println(<span class="string">"张三的第2门成绩:"</span>+score2);</span><br><span class="line"> System.out.println(<span class="string">"张三的第3门成绩:"</span>+score3);</span><br><span class="line"> System.out.println(<span class="string">"张三的第4门成绩:"</span>+score4);</span><br><span class="line"> System.out.println(<span class="string">"张三的第5门成绩:"</span>+score5);</span><br><span class="line"> System.out.println(<span class="string">"张三的平均成绩是"</span>+(score1+score2+score3+score4+score5)/<span class="number">5</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<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></pre></td><td class="code"><pre><span class="line"><span class="comment">// 8.计算1-10之间的整数之和,如果得到的累加值大于30,则停止循环,返回当前累加值。</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Test12</span> </span>{</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>{</span><br><span class="line"> <span class="keyword">int</span> sum = <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">1</span>; i <= <span class="number">10</span>; i++) {</span><br><span class="line"> sum += i;</span><br><span class="line"> <span class="keyword">if</span>(sum > <span class="number">30</span>) {</span><br><span class="line"> sum -= i;</span><br><span class="line"> <span class="keyword">break</span>;</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> System.out.println(sum);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</div><div class="article-tags size-small mb-4"><span class="mr-2">#</span><a class="link-muted mr-2" rel="tag" href="/tags/Java/">Java</a></div><div class="bdsharebuttonbox"><a class="bds_more" href="#" data-cmd="more"></a><a class="bds_qzone" href="#" data-cmd="qzone" title="分享到QQ空间"></a><a class="bds_tsina" href="#" data-cmd="tsina" title="分享到新浪微博"></a><a class="bds_tqq" href="#" data-cmd="tqq" title="分享到腾讯微博"></a><a class="bds_renren" href="#" data-cmd="renren" title="分享到人人网"></a><a class="bds_weixin" href="#" data-cmd="weixin" title="分享到微信"></a></div><script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script></article></div><div class="card"><div class="card-content"><h3 class="menu-label has-text-centered">喜欢这篇文章?打赏一下作者吧</h3><div class="buttons is-centered"><a class="button is-info donate"><span class="icon is-small"><i class="fab fa-alipay"></i></span><span>支付宝</span><span class="qrcode"><img src="/img/AliPay.jpg" alt="支付宝"></span></a><a class="button is-success donate"><span class="icon is-small"><i class="fab fa-weixin"></i></span><span>微信</span><span class="qrcode"><img src="/img/WeChatPay.png" alt="微信"></span></a></div></div></div><nav class="post-navigation mt-4 level is-mobile"><div class="level-start"><a class="article-nav-prev level level-item link-muted" href="/hexo%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.html"><i class="level-item fas fa-chevron-left"></i><span class="level-item">hexo使用说明</span></a></div><div class="level-end"><a class="article-nav-next level level-item link-muted" href="/Java-3%E8%BF%90%E7%AE%97%E7%AC%A6.html"><span class="level-item">Java-3.运算符</span><i class="level-item fas fa-chevron-right"></i></a></div></nav><div class="card"><div class="card-content"><h3 class="title is-5">评论</h3><div class="content" id="valine-thread"></div><script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Valine.min.js"></script><script>new Valine({
el: '#valine-thread' ,
appId: "YBaknCd9gxOKiiyS9UYXOh5k-gzGzoHsz",
appKey: "Bm9h6VVbcnoBmC33AsD99Fgz",
placeholder: "来,说两句儿~",
avatar: "mm",
meta: ["nick","mail","link"],
pageSize: 10,
lang: "zh-CN",
highlight: true,
requiredFields: [],
});</script></div></div></div><div class="column column-left is-4-tablet is-4-desktop is-4-widescreen order-1"><div class="card widget"><div class="card-content"><nav class="level"><div class="level-item has-text-centered flex-shrink-1"><div><figure class="image is-128x128 mx-auto mb-2"><img class="avatar is-rounded" src="/img/myAvatar.jpg" alt="蒋志伟"></figure><p class="title is-size-4 is-block line-height-inherit">蒋志伟</p><p class="is-size-6 is-block">前端开发</p><p class="is-size-6 is-flex justify-content-center"><i class="fas fa-map-marker-alt mr-1"></i><span>中国-珠海</span></p></div></div></nav><nav class="level is-mobile"><div class="level-item has-text-centered is-marginless"><div><p class="heading">文章</p><a href="/archives"><p class="title">9</p></a></div></div><div class="level-item has-text-centered is-marginless"><div><p class="heading">分类</p><a href="/categories"><p class="title">2</p></a></div></div><div class="level-item has-text-centered is-marginless"><div><p class="heading">标签</p><a href="/tags"><p class="title">5</p></a></div></div></nav><div class="level"><a class="level-item button is-primary is-rounded" href="https://github.com/jzwnju" target="_blank" rel="noopener">关注我</a></div><div class="level is-mobile"><a class="level-item button is-transparent is-marginless" target="_blank" rel="noopener" title="Github" href="https://github.com/jzwnju"><i class="fab fa-github"></i></a><a class="level-item button is-transparent is-marginless" target="_blank" rel="noopener" title="微博" href="https://weibo.com/u/3757446997/"><i class="fab fa-weibo"></i></a><a class="level-item button is-transparent is-marginless" target="_blank" rel="noopener" title="RSS" href="/"><i class="fas fa-rss"></i></a></div></div></div><!--!--><div class="card widget"><div class="card-content"><div class="menu"><h3 class="menu-label">链接</h3><ul class="menu-list"><li><a class="level is-mobile is-mobile" href="https://blog.csdn.net/qq_39852145" target="_blank" rel="noopener"><span class="level-left"><span class="level-item">CSDN</span></span><span class="level-right"><span class="level-item tag">blog.csdn.net</span></span></a></li><li><a class="level is-mobile is-mobile" href="https://juejin.im/user/5c32c6a8e51d4552475fa144/" target="_blank" rel="noopener"><span class="level-left"><span class="level-item">掘金</span></span><span class="level-right"><span class="level-item tag">juejin.im</span></span></a></li><li><a class="level is-mobile is-mobile" href="https://segmentfault.com/u/crmmf" target="_blank" rel="noopener"><span class="level-left"><span class="level-item">思否</span></span><span class="level-right"><span class="level-item tag">segmentfault.com</span></span></a></li></ul></div></div></div><div class="card widget"><div class="card-content"><div class="menu"><h3 class="menu-label">分类</h3><ul class="menu-list"><li><a class="level is-mobile is-marginless" href="/categories/%E5%89%8D%E7%AB%AF/"><span class="level-start"><span class="level-item">前端</span></span><span class="level-end"><span class="level-item tag">4</span></span></a></li><li><a class="level is-mobile is-marginless" href="/categories/%E5%90%8E%E7%AB%AF/"><span class="level-start"><span class="level-item">后端</span></span><span class="level-end"><span class="level-item tag">4</span></span></a></li></ul></div></div></div><div class="card widget"><div class="card-content"><h3 class="menu-label">最新文章</h3><article class="media"><a class="media-left" href="/2-ts%E5%BF%AB%E9%80%9F%E5%AD%A6%E4%B9%A0.html"><p class="image is-64x64"><img class="thumbnail" src="/../assets/img/thumbnails/6.jpg" alt="2-ts快速学习"></p></a><div class="media-content size-small"><p><time dateTime="2020-01-08T13:01:26.000Z">2020-01-08</time></p><p class="title is-6"><a class="link-muted" href="/2-ts%E5%BF%AB%E9%80%9F%E5%AD%A6%E4%B9%A0.html">2-ts快速学习</a></p><p class="is-uppercase"><a class="link-muted" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></p></div></article><article class="media"><a class="media-left" href="/1-ts%E5%BF%AB%E9%80%9F%E5%AD%A6%E4%B9%A0.html"><p class="image is-64x64"><img class="thumbnail" src="/../assets/img/thumbnails/5.jpg" alt="1.ts快速学习"></p></a><div class="media-content size-small"><p><time dateTime="2020-01-03T13:06:57.000Z">2020-01-03</time></p><p class="title is-6"><a class="link-muted" href="/1-ts%E5%BF%AB%E9%80%9F%E5%AD%A6%E4%B9%A0.html">1.ts快速学习</a></p><p class="is-uppercase"><a class="link-muted" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></p></div></article><article class="media"><a class="media-left" href="/css%E5%B1%9E%E6%80%A7%E4%B9%8Bposition-sticky.html"><p class="image is-64x64"><img class="thumbnail" src="/../assets/img/thumbnails/3.jpg" alt="css属性之position:sticky"></p></a><div class="media-content size-small"><p><time dateTime="2020-01-02T14:23:49.000Z">2020-01-02</time></p><p class="title is-6"><a class="link-muted" href="/css%E5%B1%9E%E6%80%A7%E4%B9%8Bposition-sticky.html">css属性之position:sticky</a></p><p class="is-uppercase"><a class="link-muted" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></p></div></article><article class="media"><a class="media-left" href="/Java-1%E5%88%9D%E8%AF%86Java.html"><p class="image is-64x64"><img class="thumbnail" src="/../assets/img/thumbnails/4.jpg" alt="初识Java"></p></a><div class="media-content size-small"><p><time dateTime="2019-12-13T13:30:20.000Z">2019-12-13</time></p><p class="title is-6"><a class="link-muted" href="/Java-1%E5%88%9D%E8%AF%86Java.html">初识Java</a></p><p class="is-uppercase"><a class="link-muted" href="/categories/%E5%90%8E%E7%AB%AF/">后端</a></p></div></article><article class="media"><a class="media-left" href="/vue%E7%9A%84%E6%8F%92%E6%A7%BD.html"><p class="image is-64x64"><img class="thumbnail" src="/../assets/img/thumbnails/2.jpg" alt="vue的插槽"></p></a><div class="media-content size-small"><p><time dateTime="2019-12-12T13:36:24.000Z">2019-12-12</time></p><p class="title is-6"><a class="link-muted" href="/vue%E7%9A%84%E6%8F%92%E6%A7%BD.html">vue的插槽</a></p><p class="is-uppercase"><a class="link-muted" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></p></div></article></div></div><div class="card widget"><div class="card-content"><div class="menu"><h3 class="menu-label">归档</h3><ul class="menu-list"><li><a class="level is-mobile is-marginless" href="/archives/2020/01/"><span class="level-start"><span class="level-item">一月 2020</span></span><span class="level-end"><span class="level-item tag">3</span></span></a></li><li><a class="level is-mobile is-marginless" href="/archives/2019/12/"><span class="level-start"><span class="level-item">十二月 2019</span></span><span class="level-end"><span class="level-item tag">2</span></span></a></li><li><a class="level is-mobile is-marginless" href="/archives/2019/10/"><span class="level-start"><span class="level-item">十月 2019</span></span><span class="level-end"><span class="level-item tag">1</span></span></a></li><li><a class="level is-mobile is-marginless" href="/archives/2019/06/"><span class="level-start"><span class="level-item">六月 2019</span></span><span class="level-end"><span class="level-item tag">3</span></span></a></li></ul></div></div></div><div class="card widget"><div class="card-content"><div class="menu"><h3 class="menu-label">标签</h3><div class="field is-grouped is-grouped-multiline"><div class="control"><a class="tags has-addons" href="/tags/Java/"><span class="tag">Java</span><span class="tag is-grey-lightest">4</span></a></div><div class="control"><a class="tags has-addons" href="/tags/TypeScript/"><span class="tag">TypeScript</span><span class="tag is-grey-lightest">2</span></a></div><div class="control"><a class="tags has-addons" href="/tags/css/"><span class="tag">css</span><span class="tag is-grey-lightest">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/vue/"><span class="tag">vue</span><span class="tag is-grey-lightest">1</span></a></div><div class="control"><a class="tags has-addons" href="/tags/%E5%85%B6%E5%AE%83/"><span class="tag">其它</span><span class="tag is-grey-lightest">1</span></a></div></div></div></div></div><div class="card widget"><div class="card-content"><div class="menu"><h3 class="menu-label">订阅更新</h3><form action="https://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('https://feedburner.google.com/fb/a/mailverify?uri=','popupwindow','scrollbars=yes,width=550,height=520');return true"><input type="hidden" value="" name="uri"><input type="hidden" name="loc" value="en_US"><div class="field has-addons"><div class="control has-icons-left is-expanded"><input class="input" name="email" type="email" placeholder="Email"><span class="icon is-small is-left"><i class="fas fa-envelope"></i></span></div><div class="control"><input class="button is-primary" type="submit" value="订阅"></div></div></form></div></div></div></div><!--!--></div></div></section><footer class="footer"><div class="container"><div class="level"><div class="level-start"><a class="footer-logo is-block mb-2" href="/"><img src="/img/myAvatar.jpg" alt="蒋志伟的个人网站" height="28"></a><p class="size-small"><span>© 2020 蒋志伟</span> Powered by <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a> & <a href="https://github.com/ppoffice/hexo-theme-icarus" target="_blank" rel="noopener">Icarus</a><br><span id="busuanzi_container_site_uv">共<span id="busuanzi_value_site_uv">0</span>个访客</span></p></div><div class="level-end"><div class="field has-addons"><p class="control"><a class="button is-transparent is-large" target="_blank" rel="noopener" title="前往微博" href="https://weibo.com/u/3757446997/"><i class="fab fa-weibo"></i></a></p><p class="control"><a class="button is-transparent is-large" target="_blank" rel="noopener" title="前往 GitHub" href="https://github.com/jzwnju"><i class="fab fa-github"></i></a></p></div></div></div></div></footer><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/min/moment-with-locales.min.js"></script><script>moment.locale("zh-CN");</script><script>var IcarusThemeSettings = {
site: {
url: 'https://jiangzhiwei.cn',
external_link: {"enable":true,"exclude":[]}
},
article: {
highlight: {
clipboard: true,
fold: 'unfolded'
}
}
};</script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js" defer></script><script src="/js/animation.js"></script><a id="back-to-top" title="回到顶端" href="javascript:;"><i class="fas fa-chevron-up"></i></a><script src="/js/back_to_top.js" defer></script><!--!--><!--!--><script src="https://s9.cnzz.com/z_stat.php?id=1278950954&web_id=1278950954" async></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/lightgallery.min.js" defer></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/jquery.justifiedGallery.min.js" defer></script><script>window.addEventListener("load", () => {
if (typeof $.fn.lightGallery === 'function') {
$('.article').lightGallery({ selector: '.gallery-item' });
}
if (typeof $.fn.justifiedGallery === 'function') {
if ($('.justified-gallery > p > .gallery-item').length) {
$('.justified-gallery > p > .gallery-item').unwrap();
}
$('.justified-gallery').justifiedGallery();
}
});</script><!--!--><!--!--><!--!--><script src="/js/main.js" defer></script><div class="searchbox"><div class="searchbox-container"><div class="searchbox-header"><div class="searchbox-input-container"><input class="searchbox-input" type="text" placeholder="想要查找什么..."></div><a class="searchbox-close" href="javascript:;">×</a></div><div class="searchbox-body"></div></div></div><script src="/js/insight.js" defer></script><script>document.addEventListener('DOMContentLoaded', function () {
loadInsight({"contentUrl":"/content.json"}, {"hint":"想要查找什么...","untitled":"(无标题)","posts":"文章","pages":"页面","categories":"分类","tags":"标签"});
});</script></body></html>