This repository has been archived on 2025-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
Files
vitepress-theme-blog-charle…/courses/java/01-Java语法入门/09-switch选择结构.html

107 lines
92 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>switch选择结构 | 查尔斯的知识库</title>
<meta name="description" content="个人技术知识库,记录 & 分享个人碎片化、结构化、体系化的技术知识内容。">
<meta name="generator" content="VitePress v1.0.0-rc.31">
<link rel="preload stylesheet" href="/assets/style.-TyODVlN.css" as="style">
<script type="module" src="/assets/app.wVULdALl.js"></script>
<link rel="preload" href="/assets/inter-roman-latin.bvIUbFQP.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="modulepreload" href="/assets/chunks/framework.FVQzxbLi.js">
<link rel="modulepreload" href="/assets/chunks/theme.H88Ua6lx.js">
<link rel="modulepreload" href="/assets/chunks/md5.RtphNWHi.js">
<link rel="modulepreload" href="/assets/chunks/use-popup-manager.-j2MED7j.js">
<link rel="modulepreload" href="/assets/chunks/ArticleMetadata.Sb1DYAHo.js">
<link rel="modulepreload" href="/assets/courses_java_01-Java语法入门_09-switch选择结构.md.p1ZypRLa.lean.js">
<link rel="icon" href="/favicon.ico">
<meta name="author" content="Charles7c">
<meta name="keywords" content="查尔斯的知识库, 知识库, 博客, Charles7c">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="theme-color" content="#3c8772">
<meta property="og:type" content="website">
<meta property="og:locale" content="zh_CN">
<meta property="og:title" content="查尔斯的知识库">
<meta property="og:description" content="个人技术知识库,记录 &amp; 分享个人碎片化、结构化、体系化的技术知识内容。">
<meta property="og:site" content="https://blog.charles7c.top">
<meta property="og:site_name" content="查尔斯的知识库">
<meta property="og:image" content="https://blog.charles7c.top/logo.jpg">
<script>var _hmt=_hmt||[];(function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?53af4b1a12fbe40810ca7ad39f8db9c7";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
</head>
<body>
<div id="app"><div class="Layout" data-v-03322d68><!--[--><!--]--><!--[--><span tabindex="-1" data-v-c4918e4e></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-c4918e4e> Skip to content </a><!--]--><!----><header class="VPNav" data-v-03322d68 data-v-629c70bd><div class="VPNavBar has-sidebar" data-v-629c70bd data-v-1d72176a><div class="container" data-v-1d72176a><div class="title" data-v-1d72176a><div class="VPNavBarTitle has-sidebar" data-v-1d72176a data-v-21327bbd><a class="title" href="/" data-v-21327bbd><!--[--><!--]--><!--[--><img class="VPImage logo" src="/logo.png" alt data-v-d7b35c78><!--]--><!--[-->查尔斯的知识库<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-1d72176a><div class="curtain" data-v-1d72176a></div><div class="content-body" data-v-1d72176a><!--[--><!--]--><div class="VPNavBarSearch search" data-v-1d72176a><!--[--><!----><div id="docsearch"><button type="button" class="DocSearch DocSearch-Button" aria-label="搜索文档"><span class="DocSearch-Button-Container"><svg class="DocSearch-Search-Icon" width="20" height="20" viewBox="0 0 20 20" aria-label="search icon"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">搜索文档</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-1d72176a data-v-a12edbe3><span id="main-nav-aria-label" class="visually-hidden" data-v-a12edbe3>Main Navigation</span><!--[--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-a12edbe3 data-v-f18e2dbf><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-f18e2dbf><span class="text" data-v-f18e2dbf><!----><span data-v-f18e2dbf>我的分类</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-f18e2dbf><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-f18e2dbf><div class="VPMenu" data-v-f18e2dbf data-v-8a7fe2f1><div class="items" data-v-8a7fe2f1><!--[--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/categories/issues/index" data-v-cf652a9b><!--[-->Bug万象集<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/categories/fragments/index" data-v-cf652a9b><!--[-->&quot;杂碎&quot;逆袭史<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/categories/tools/index" data-v-cf652a9b><!--[-->工具四海谈<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/categories/solutions/index" data-v-cf652a9b><!--[-->方案春秋志<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup active" data-v-a12edbe3 data-v-f18e2dbf><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-f18e2dbf><span class="text" data-v-f18e2dbf><!----><span data-v-f18e2dbf>我的小册</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-f18e2dbf><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-f18e2dbf><div class="VPMenu" data-v-f18e2dbf data-v-8a7fe2f1><div class="items" data-v-8a7fe2f1><!--[--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link active" href="/courses/java/index" data-v-cf652a9b><!--[-->Java基础快速入门<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/courses/mysql/index" data-v-cf652a9b><!--[-->MySQL快速入门<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/courses/mybatis/index" data-v-cf652a9b><!--[-->MyBatis快速入门<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/tags" tabindex="0" data-v-a12edbe3 data-v-bc587c79><!--[--><span data-v-bc587c79>我的标签</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/archives" tabindex="0" data-v-a12edbe3 data-v-bc587c79><!--[--><span data-v-bc587c79>我的归档</span><!--]--></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-a12edbe3 data-v-f18e2dbf><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-f18e2dbf><span class="text" data-v-f18e2dbf><!----><span data-v-f18e2dbf>关于</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-f18e2dbf><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-f18e2dbf><div class="VPMenu" data-v-f18e2dbf data-v-8a7fe2f1><div class="items" data-v-8a7fe2f1><!--[--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/about/index" data-v-cf652a9b><!--[-->关于知识库<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-8a7fe2f1 data-v-cf652a9b><a class="VPLink link" href="/about/me" data-v-cf652a9b><!--[-->关于我<!--]--></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-1d72176a data-v-c2c90abb><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-c2c90abb data-v-1502017d data-v-54e1997a><span class="check" data-v-54e1997a><span class="icon" data-v-54e1997a><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-1502017d><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-1502017d><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-1d72176a data-v-804ae77e data-v-f57dd261><!--[--><a class="VPSocialLink no-icon" href="https://github.com/Charles7c/charles7c.github.io" aria-label="github" target="_blank" rel="noopener" data-v-f57dd261 data-v-19217157><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><a class="VPSocialLink no-icon" href="https://gitee.com/Charles7c/charles7c" aria-label target="_blank" rel="noopener" data-v-f57dd261 data-v-19217157><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>码云</title><path d="M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.15a.592.592 0 0 1-.592-.592v-1.482a.593.593 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H5.926a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h8.296Z"/></svg></a><a class="VPSocialLink no-icon" href="https://cnadmin.charles7c.top/" aria-label target="_blank" rel="noopener" data-v-f57dd261 data-v-19217157><svg width="33" height="33" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 174.8 204">
<title>ContiNew Admin</title>
<path fill="#307AF2" d="M86.7,0l88,51v.2l-16.3,9.4v-.2L86.7,18.9Zm71.8,143.5,16.3,9.4v.2L86.8,204h0l-16.3-9.4,16.3-9.4h0l71.7-41.5v-.2Z"/>
<path fill="#12D2AC" d="M16.3,143.5v.2L58,167.8l-16.3,9.4L0,153.1v-.2Z"/>
<path fill="#12D2AC" d="M104.1,93,15.9,143.8l-.2-.1V124.9l.2.1L87.7,83.6,104.1,93Z"/>
<path fill="#0057FE" d="M88.1,0,.1,51v.2l16.3,9.4v-.2L88.1,18.9Z"/>
<path fill="#307AF2" d="M.1,50.9.2,152.6l.2.1,16.3-9.4-.2-.1-.1-82.9L.1,50.9Z"/>
<path fill="#0057FE" d="M174.7,50.9l-.1,101.7-.2.1-16.3-9.4.2-.1.1-82.9Z"/>
<path fill="#12D2AC" d="M41.7,158.5l16.1,9.4,100.6-58.7V90.4Z"/>
</svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-1d72176a data-v-3893c6ae data-v-f18e2dbf><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-f18e2dbf><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-f18e2dbf><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-f18e2dbf><div class="VPMenu" data-v-f18e2dbf data-v-8a7fe2f1><!----><!--[--><!--[--><!----><div class="group" data-v-3893c6ae><div class="item appearance" data-v-3893c6ae><p class="label" data-v-3893c6ae>切换日光/暗黑模式</p><div class="appearance-action" data-v-3893c6ae><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-3893c6ae data-v-1502017d data-v-54e1997a><span class="check" data-v-54e1997a><span class="icon" data-v-54e1997a><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-1502017d><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-1502017d><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><div class="group" data-v-3893c6ae><div class="item social-links" data-v-3893c6ae><div class="VPSocialLinks social-links-list" data-v-3893c6ae data-v-f57dd261><!--[--><a class="VPSocialLink no-icon" href="https://github.com/Charles7c/charles7c.github.io" aria-label="github" target="_blank" rel="noopener" data-v-f57dd261 data-v-19217157><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><a class="VPSocialLink no-icon" href="https://gitee.com/Charles7c/charles7c" aria-label target="_blank" rel="noopener" data-v-f57dd261 data-v-19217157><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>码云</title><path d="M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.15a.592.592 0 0 1-.592-.592v-1.482a.593.593 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H5.926a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h8.296Z"/></svg></a><a class="VPSocialLink no-icon" href="https://cnadmin.charles7c.top/" aria-label target="_blank" rel="noopener" data-v-f57dd261 data-v-19217157><svg width="33" height="33" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 174.8 204">
<title>ContiNew Admin</title>
<path fill="#307AF2" d="M86.7,0l88,51v.2l-16.3,9.4v-.2L86.7,18.9Zm71.8,143.5,16.3,9.4v.2L86.8,204h0l-16.3-9.4,16.3-9.4h0l71.7-41.5v-.2Z"/>
<path fill="#12D2AC" d="M16.3,143.5v.2L58,167.8l-16.3,9.4L0,153.1v-.2Z"/>
<path fill="#12D2AC" d="M104.1,93,15.9,143.8l-.2-.1V124.9l.2.1L87.7,83.6,104.1,93Z"/>
<path fill="#0057FE" d="M88.1,0,.1,51v.2l16.3,9.4v-.2L88.1,18.9Z"/>
<path fill="#307AF2" d="M.1,50.9.2,152.6l.2.1,16.3-9.4-.2-.1-.1-82.9L.1,50.9Z"/>
<path fill="#0057FE" d="M174.7,50.9l-.1,101.7-.2.1-16.3-9.4.2-.1.1-82.9Z"/>
<path fill="#12D2AC" d="M41.7,158.5l16.1,9.4,100.6-58.7V90.4Z"/>
</svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-1d72176a data-v-a6ca9ab6><span class="container" data-v-a6ca9ab6><span class="top" data-v-a6ca9ab6></span><span class="middle" data-v-a6ca9ab6></span><span class="bottom" data-v-a6ca9ab6></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav reached-top" data-v-03322d68 data-v-b9e3214b><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-b9e3214b><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-b9e3214b><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-b9e3214b>文章</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-b9e3214b data-v-06057024><button data-v-06057024>返回顶部</button><!----></div></div><aside class="VPSidebar" data-v-03322d68 data-v-802ad7d8><div class="curtain" data-v-802ad7d8></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-802ad7d8><span class="visually-hidden" id="sidebar-aria-label" data-v-802ad7d8> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-802ad7d8><section class="VPSidebarItem level-0 collapsible has-active" data-v-802ad7d8 data-v-95d837d1><div class="item" role="button" tabindex="0" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><h2 class="text" data-v-95d837d1>Java语法入门 (14篇)</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-95d837d1><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-95d837d1><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-95d837d1><!--[--><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/01-%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-red mr-[6px]" style="font-weight: 550; display: inline-block;">1</div>开发环境搭建</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/02-%E7%AC%AC%E4%B8%80%E4%B8%AAJava%E7%A8%8B%E5%BA%8F" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-orange mr-[6px]" style="font-weight: 550; display: inline-block;">2</div>第一个Java程序</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/03-%E5%88%9D%E8%AF%86Eclipse" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-yellow mr-[6px]" style="font-weight: 550; display: inline-block;">3</div>初识Eclipse</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/04-%E7%A8%8B%E5%BA%8F%E5%92%8C%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%9A%84%E9%82%A3%E7%82%B9%E4%BA%8B%E5%84%BF" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">4</div>程序和计算机的那点事儿</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/05-%E5%8F%98%E9%87%8F%E5%92%8C%E5%B8%B8%E9%87%8F" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">5</div>变量和常量</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/06-%E5%B8%B8%E7%94%A8%E7%9A%84%E8%BF%90%E7%AE%97%E7%AC%A6" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">6</div>常用的运算符</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/07-%E6%8E%A7%E5%88%B6%E8%AF%AD%E5%8F%A5%E5%92%8C%E6%B5%81%E7%A8%8B%E5%9B%BE" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">7</div>控制语句和流程图</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/08-if%E9%80%89%E6%8B%A9%E7%BB%93%E6%9E%84" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">8</div>if选择结构</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/09-switch%E9%80%89%E6%8B%A9%E7%BB%93%E6%9E%84" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">9</div>switch选择结构</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/10-%E5%BE%AA%E7%8E%AF%E7%BB%93%E6%9E%84" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">10</div>循环结构</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/11-%E5%A4%9A%E9%87%8D%E5%BE%AA%E7%8E%AF" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">11</div>多重循环</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/12-%E7%A8%8B%E5%BA%8F%E8%B0%83%E8%AF%95%E5%85%A5%E9%97%A8" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">12</div>程序调试入门</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/13-%E4%B8%80%E7%BB%B4%E6%95%B0%E7%BB%84" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">13</div>一维数组</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/14-%E5%A4%9A%E7%BB%B4%E6%95%B0%E7%BB%84" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">14</div>多维数组</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-802ad7d8><section class="VPSidebarItem level-0 collapsible collapsed" data-v-802ad7d8 data-v-95d837d1><div class="item" role="button" tabindex="0" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><h2 class="text" data-v-95d837d1>Java面向对象 (1篇)</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-95d837d1><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-95d837d1><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-95d837d1><!--[--><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/02-Java%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1/01-%E7%B1%BB%E5%92%8C%E5%AF%B9%E8%B1%A1" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-red mr-[6px]" style="font-weight: 550; display: inline-block;">1</div>类和对象</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-802ad7d8><section class="VPSidebarItem level-0 collapsible collapsed" data-v-802ad7d8 data-v-95d837d1><div class="item" role="button" tabindex="0" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><h2 class="text" data-v-95d837d1>Java高级特性 (1篇)</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-95d837d1><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-95d837d1><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-95d837d1><!--[--><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/03-Java%E9%AB%98%E7%BA%A7%E7%89%B9%E6%80%A7/01-%E9%9B%86%E5%90%88%E4%B8%8E%E6%B3%9B%E5%9E%8B-1" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-red mr-[6px]" style="font-weight: 550; display: inline-block;">1</div>集合与泛型-1</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-802ad7d8><section class="VPSidebarItem level-0 collapsible collapsed" data-v-802ad7d8 data-v-95d837d1><div class="item" role="button" tabindex="0" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><h2 class="text" data-v-95d837d1>附录 (1篇)</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-95d837d1><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-95d837d1><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-95d837d1><!--[--><div class="VPSidebarItem level-1 is-link" data-v-95d837d1 data-v-95d837d1><div class="item" data-v-95d837d1><div class="indicator" data-v-95d837d1></div><a class="VPLink link link" href="/courses/java/04-%E9%99%84%E5%BD%95/01-CentOS%E5%AE%89%E8%A3%85JDK" data-v-95d837d1><!--[--><p class="text" data-v-95d837d1><div class="text-color-red mr-[6px]" style="font-weight: 550; display: inline-block;">1</div>CentOS 8.2 安装 JDK 1.8.0_202</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-03322d68 data-v-2c336b25><div class="VPDoc has-sidebar has-aside" data-v-2c336b25 data-v-53ed897c><!--[--><!--]--><div class="container" data-v-53ed897c><div class="aside" data-v-53ed897c><div class="aside-curtain" data-v-53ed897c></div><div class="aside-container" data-v-53ed897c><div class="aside-content" data-v-53ed897c><div class="VPDocAside" data-v-53ed897c data-v-3d450548><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-3d450548 data-v-70b38f01><div class="content" data-v-70b38f01><div class="outline-marker" data-v-70b38f01></div><div class="outline-title" role="heading" aria-level="2" data-v-70b38f01>目录</div><nav aria-labelledby="doc-outline-aria-label" data-v-70b38f01><span class="visually-hidden" id="doc-outline-aria-label" data-v-70b38f01> Table of Contents for current page </span><ul class="root" data-v-70b38f01 data-v-e10534d6><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-3d450548></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-53ed897c><div class="content-container" data-v-53ed897c><!--[--><!--]--><!----><main class="main" data-v-53ed897c><div style="position:relative;" class="vp-doc _courses_java_01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8_09-switch%E9%80%89%E6%8B%A9%E7%BB%93%E6%9E%84" data-v-53ed897c><div><h1 id="switch选择结构" tabindex="-1">switch选择结构 <a class="header-anchor" href="#switch选择结构" aria-label="Permalink to &quot;switch选择结构&quot;"></a></h1><!----><h2 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to &quot;前言&quot;"></a></h2><p><strong>C</strong> 上一篇我们介绍了 if 系列的选择结构语法整体感受应该是简单易懂且易写的。本篇笔者再介绍一种选择结构语法switch但此 switch 非彼 switch。</p><p><img src="/assets/202010071310906.ws-Z9S6R.png" alt="202010071310906"></p><h2 id="why" tabindex="-1">Why <a class="header-anchor" href="#why" aria-label="Permalink to &quot;Why&quot;"></a></h2><p>有了 if ,为什么还要学习使用 switch 选择结构呢?一起来看个案例。</p><p><strong>案例需求小杨参加了创造502节目。</strong></p><ul><li>如果获得第一名,将会担任《诛仙》女主角</li><li>如果获得第二名,将会担任《斗罗大陆》女主角</li><li>如果获得第三名,将会担任《永夜》女主角</li></ul><p>从需求介绍中可知,案例的条件表达式是简单的等值判断,但是条件很多而且彼此都是互斥的,可以采用多重 if 来实现。</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 存储名次</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> score</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 使用多重if</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> (score </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">) {</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《诛仙》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">} </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">else</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> (score </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">) {</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《斗罗大陆》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">} </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">else</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> (score </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 3</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">) {</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《永夜》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">}</span></span></code></pre></div><p>但相比于范围判断,在等值判断时使用 <code>多重if</code> 有点大材小用,实话就是 if 多了阅读起来真挺费劲的,所以笔者才给大家安利 Java 提供的另一个选择结构语句:<code>switch选择结构</code></p><p>我们来看看它的语法:</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">switch</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> (表达式) {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 常量1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 语句;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 常量2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 语句;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;"> // ....</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> default:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> 语句;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">}</span></span></code></pre></div><p>再套用它的语法来解决一下刚才的问题,是不是发现清晰多了?</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 存储名次</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> score</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 使用switch</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">switch</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> (score) {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《诛仙》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《斗罗大陆》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 3</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《永夜》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">}</span></span></code></pre></div><h2 id="使用注意" tabindex="-1">使用注意 <a class="header-anchor" href="#使用注意" aria-label="Permalink to &quot;使用注意&quot;"></a></h2><ol><li><p>在满足等值判断的前提下,才可以使用 <code>switch</code> 来进行判断,不可用于范围型判断。</p></li><li><p>如果没有特殊要求,必须给每一个 <code>case</code> 后追加 <code>break</code></p><p><code>break</code> 是表示结束某个 <code>case</code>,如果没有 <code>break</code>,会出现 <code>case</code> 的穿透性,即继续往下执行直到遇到下一个 <code>break</code> 结束!</p><div class="language-java vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 存储名次</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> score</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> =</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390;">// 使用switch</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">switch</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(score){</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《诛仙》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《斗罗大陆》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> case</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF;"> 3</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;"> System.out.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB;">println</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF;">&quot;小杨将会担任《永夜》女主角!&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067;"> break</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7;">}</span></span></code></pre></div><p>上方的代码,如果 <code>case 1</code> 后缺少一个 <code>break</code>,那么输出结果是将会是。</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark-dimmed vp-code"><code><span class="line"><span>小杨将会担任《诛仙》女主角!</span></span>
<span class="line"><span>小杨将会担任《斗罗大陆》女主角!</span></span></code></pre></div></li><li><p>建议加上一个 <code>default</code> 来进行默认处理。</p></li><li><p><code>switch</code> 的表达式支持的类型有:<code>int</code>、( <code>short</code><code>byte</code><code>char</code> 可以自动类型转换为 <code>int</code>)<code>枚举类型(Enum)</code><code>String</code>自JDK1.7开始,<code>switch</code> 支持了字符串的等值判断,参考<a href="https://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html" target="_blank" rel="noreferrer">Oracle Java7 RELEASE介绍</a>)。</p><p><img src="/assets/202010071312989.50VSngVD.png" alt="202010071312989"></p><p><img src="/assets/202010071315171.z0e6P2p8.png" alt="202010071315171"></p></li></ol><h2 id="switch和if的对比" tabindex="-1">switch和if的对比 <a class="header-anchor" href="#switch和if的对比" aria-label="Permalink to &quot;switch和if的对比&quot;"></a></h2><p>到此为止Java 中的选择结构我们就学习完了,别看语法挺多,论派系的话只有两个,一个是 <code>if</code>,一个是<code>switch</code>,而且 <code>switch</code><code>多重if</code> 也很相像,理解起来也比较容易了。</p><p><strong>相同点:</strong> 都是用来处理多分支条件的结构。</p><p><strong>不同点:</strong> <code>switch</code> 只能处理等值条件判断的情况,<code>多重if</code> 选择结构没有 <code>switch</code> 选择结构的限制,特别适合某个变量处于某个连续区间时的情况(范围型判断)。</p><p><code>switch</code> 从效率方面考虑,是要比 <code>if</code> 选择结构执行快(有兴趣自己百度下执行原理),但是随着硬件的发展,这两者之间的效率差距几乎可以忽略不计。</p><div class="tip custom-block"><p class="custom-block-title">笔者说</p><p>其实 Java 近几版本一直在对 <code>switch</code> 进行优化switch 的使用也更加现代,后面有机会使用其他版本,再给大家开开眼。</p></div><h2 id="后记" tabindex="-1">后记 <a class="header-anchor" href="#后记" aria-label="Permalink to &quot;后记&quot;"></a></h2><p>选择结构出现后,我们就可以把现实生活的业务逻辑,在程序中模拟实现了。这些流程控制语句就像汉语拼音和基本汉字一样基础,好好记忆下语法。</p><p>把文章案例实现一下,千万要动手实现!因为理解和熟练掌握是两回事!就好像你在抖音上看了那么多生活上的教程:叠衣服、弹吉他.....,但你从没练过,那永远是学不会的,千万不要眼高手低。</p><div class="info custom-block"><p class="custom-block-title">笔者说</p><p>对于技术的学习,笔者一贯遵循的步骤是:先用最最简单的 demo 让它跑起来,然后学学它的最最常用 API 和 配置让自己能用起来,最后熟练使用的基础上,在空闲时尝试阅读它的源码让自己能够洞彻它的运行机制,部分问题出现的原因,同时借鉴这些技术实现来提升自己的代码高度。</p><p>所以在笔者的文章中,前期基本都是小白文,仅仅穿插很少量的源码研究。当然等小白文更新多了,你们还依然喜欢,后期会不定时专门对部分技术的源码进行解析。</p></div></div></div></main><footer class="VPDocFooter" data-v-53ed897c data-v-f3af8004><!--[--><!--[--><!--[--><!--[--><!----><!--]--><!--]--><!--]--><!--]--><div class="edit-info" data-v-f3af8004><div class="edit-link" data-v-f3af8004><a class="VPLink link vp-external-link-icon no-icon edit-link-button" href="https://github.com/Charles7c/charles7c.github.io/edit/main/docs/courses/java/01-Java语法入门/09-switch选择结构.md" target="_blank" rel="noreferrer" data-v-f3af8004><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="edit-link-icon" aria-label="edit icon" data-v-f3af8004><path d="M18,23H4c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h7c0.6,0,1,0.4,1,1s-0.4,1-1,1H4C3.4,5,3,5.4,3,6v14c0,0.6,0.4,1,1,1h14c0.6,0,1-0.4,1-1v-7c0-0.6,0.4-1,1-1s1,0.4,1,1v7C21,21.7,19.7,23,18,23z"></path><path d="M8,17c-0.3,0-0.5-0.1-0.7-0.3C7,16.5,6.9,16.1,7,15.8l1-4c0-0.2,0.1-0.3,0.3-0.5l9.5-9.5c1.2-1.2,3.2-1.2,4.4,0c1.2,1.2,1.2,3.2,0,4.4l-9.5,9.5c-0.1,0.1-0.3,0.2-0.5,0.3l-4,1C8.2,17,8.1,17,8,17zM9.9,12.5l-0.5,2.1l2.1-0.5l9.3-9.3c0.4-0.4,0.4-1.1,0-1.6c-0.4-0.4-1.2-0.4-1.6,0l0,0L9.9,12.5z M18.5,2.5L18.5,2.5L18.5,2.5z"></path></svg> 不妥之处,敬请雅正<!--]--></a></div><div class="last-updated" data-v-f3af8004><p class="VPLastUpdated" data-v-f3af8004 data-v-a25eb6f3>最后更新: <time datetime="2022-08-24T14:34:01.000Z" data-v-a25eb6f3></time></p></div></div><nav class="prev-next" data-v-f3af8004><div class="pager" data-v-f3af8004><a class="VPLink link pager-link prev" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/08-if%E9%80%89%E6%8B%A9%E7%BB%93%E6%9E%84" data-v-f3af8004><!--[--><span class="desc" data-v-f3af8004>上一篇</span><span class="title" data-v-f3af8004><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">8</div>if选择结构</span><!--]--></a></div><div class="pager" data-v-f3af8004><a class="VPLink link pager-link next" href="/courses/java/01-Java%E8%AF%AD%E6%B3%95%E5%85%A5%E9%97%A8/10-%E5%BE%AA%E7%8E%AF%E7%BB%93%E6%9E%84" data-v-f3af8004><!--[--><span class="desc" data-v-f3af8004>下一篇</span><span class="title" data-v-f3af8004><div class="text-color-gray mr-[6px]" style="font-weight: 550; display: inline-block;">10</div>循环结构</span><!--]--></a></div></nav></footer><!--[--><!--[--><!--[--><div id="comment-container"></div><!--]--><!--]--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"about_index.md\":\"aZfz3sjq\",\"categories_fragments_2019_12_29_个人常用stream使用技巧.md\":\"CuDwLpDP\",\"categories_issues_2021_12_10_command line is too long. shorten command line for xxx or also for spring boot default configuration.md\":\"PXnmw2TY\",\"about_me.md\":\"yl4MsNR1\",\"categories_fragments_2019_12_30_个人常用hutool工具类.md\":\"8YjnAagp\",\"categories_fragments_2022_02_16_个人常用sql函数.md\":\"3XF3Onqb\",\"categories_fragments_2021_05_29_设计模式之单例模式.md\":\"Q_Kk2HQh\",\"categories_fragments_2021_03_12_精密计算工具类-bigdecimal.md\":\"zBMJQ_Bo\",\"categories_issues_2021_12_11_sql 注入攻击风险.md\":\"rljfD_Fi\",\"categories_issues_2022_09_23_解决无法重复读取请求体和响应体的问题.md\":\"QBFvmfGv\",\"categories_fragments_2023_12_21_一文详解限流接口实现.md\":\"HHXYHaRJ\",\"categories_fragments_2022_03_27_修改git所有提交记录中的作者和邮箱.md\":\"OvDDBZd4\",\"categories_fragments_2019_12_28_个人sql优化技巧.md\":\"EkdjdfOi\",\"categories_fragments_2022_08_29_内网centos服务器设置网络代理.md\":\"Wz9Gyo3N\",\"categories_fragments_2022_03_25_合并两个git仓库的历史提交记录.md\":\"e24riSJ9\",\"categories_issues_2022_10_25_解决centos8执行yum安装报错.md\":\"vWOngd9g\",\"categories_issues_2021_12_08_for循环中删除集合元素隐藏的陷阱.md\":\"HaXmdlA5\",\"categories_fragments_2023_01_06_codereview方法论与实践总结.md\":\"_2Lh_u8q\",\"categories_fragments_2022_10_26_docker安装openldap.md\":\"mcPLxA8n\",\"categories_issues_2022_10_15_解决windows桌面部分快捷方式图标变为空白的问题.md\":\"Zuxd2KdY\",\"categories_tools_index.md\":\"qDqYFV-P\",\"categories_fragments_2022_10_27_docker安装consul.md\":\"LIu1Q7_o\",\"courses_java_01-java语法入门_01-开发环境搭建.md\":\"JchJHevH\",\"courses_java_01-java语法入门_02-第一个java程序.md\":\"b9EylDVG\",\"courses_java_01-java语法入门_03-初识eclipse.md\":\"VIICcUYm\",\"categories_fragments_index.md\":\"lRTNURvo\",\"categories_fragments_2022_10_06_个人常用快捷键.md\":\"7DmE2Sdn\",\"categories_fragments_2022_11_01_使用idea进行远程程序调试.md\":\"0r_fvBId\",\"categories_fragments_2022_03_28_为指定git仓库单独配置用户名和邮箱.md\":\"qMYHQNJe\",\"categories_fragments_2022_10_28_docker安装minio.md\":\"pOrH5sCo\",\"courses_java_01-java语法入门_04-程序和计算机的那点事儿.md\":\"i4Xi0Jl0\",\"categories_fragments_2022_03_26_修改git最后一次提交记录的作者和邮箱.md\":\"hSvi24NU\",\"categories_issues_2021_12_13_无法访问f盘。文件或目录损坏且无法读取.md\":\"ly-jJhLg\",\"categories_fragments_2022_10_01_个人常用docker命令.md\":\"tQHhdswU\",\"categories_issues_2021_12_01_f盘上的回收站已损坏。是否清空该驱动器上的回收站.md\":\"dANDLbnx\",\"categories_fragments_2022_10_05_个人常用git命令.md\":\"H2ehuVi6\",\"categories_fragments_2022_10_31_centos安装docker.md\":\"aS1qV9Oq\",\"archives.md\":\"hEvO1jAg\",\"courses_java_01-java语法入门_07-控制语句和流程图.md\":\"t61wREmj\",\"courses_java_01-java语法入门_06-常用的运算符.md\":\"ERU0p3Fx\",\"categories_fragments_2019_12_31_个人常用linux命令.md\":\"lx3qwmph\",\"courses_java_02-java面向对象_01-类和对象.md\":\"A4c0BkF0\",\"courses_java_03-java高级特性_01-集合与泛型-1.md\":\"3f19_0FV\",\"courses_java_04-附录_01-centos安装jdk.md\":\"mrm2xLeJ\",\"courses_java_index.md\":\"Vd-Tt2Gz\",\"courses_mybatis_01-mybatis基础_01-快速入门.md\":\"KXcjGx0w\",\"courses_java_01-java语法入门_14-多维数组.md\":\"C3Jtu4yX\",\"courses_mybatis_01-mybatis基础_02-核心对象.md\":\"J2u3OyyP\",\"courses_mybatis_01-mybatis基础_05-sql映射文件之增删改元素.md\":\"Q1bwfP8k\",\"courses_mybatis_01-mybatis基础_03-核心配置文件.md\":\"pjBK9LfV\",\"courses_mybatis_01-mybatis基础_04-sql映射文件之查询元素.md\":\"UYQRCMvg\",\"courses_mybatis_01-mybatis基础_07-sql映射文件之缓存元素.md\":\"9orUXUze\",\"courses_mybatis_01-mybatis基础_06-sql映射文件之自定义映射元素.md\":\"yafOyEf1\",\"courses_mybatis_02-mybatis-plus基础_01-快速入门.md\":\"2M92eqRH\",\"courses_mybatis_02-mybatis-plus基础_03-简单查询操作.md\":\"OO_paHtp\",\"courses_mybatis_02-mybatis-plus基础_02-增删改操作.md\":\"0wJpZsHd\",\"courses_mybatis_01-mybatis基础_08-动态sql.md\":\"EiHlJ807\",\"courses_mybatis_02-mybatis-plus基础_05-代码生成器.md\":\"hjpH5d8x\",\"courses_mybatis_02-mybatis-plus基础_04-条件构造器.md\":\"v-MWEs-l\",\"courses_mysql_03-附录_01-centos安装mysql.md\":\"ZEGR5OmN\",\"categories_issues_index.md\":\"Yzlc8cBS\",\"courses_mysql_01-mysql基础_01-mysql安装与配置.md\":\"bXq0pYDh\",\"courses_mysql_03-附录_02-docker安装mysql.md\":\"Qay1Rxzf\",\"index.md\":\"rpby8rrg\",\"categories_issues_2022_01_26_javascript 无法存储 java long 类型数据问题.md\":\"IO54X60W\",\"categories_issues_2022_03_24_创建一个自身类的静态对象变量究竟会如何执行.md\":\"_sjVm5kR\",\"categories_issues_2022_08_31_springboot项目引入openfeign后无法启动.md\":\"ChRCkQV5\",\"categories_issues_2022_10_29_docker设置网络代理.md\":\"5gbvC2uf\",\"categories_issues_2022_09_05_nginx转发请求报13permission denied错误.md\":\"PClZAC2K\",\"categories_issues_2022_11_06_解决dotnet安装后报错的问题.md\":\"skCbcShV\",\"categories_tools_2021_03_06_postman快速入门.md\":\"7P3rh4Zw\",\"categories_issues_2022_11_23_解决maven传递依赖污染的问题.md\":\"GY3psqIs\",\"categories_fragments_2022_12_07_网站开启灰色显示.md\":\"ALiJge8d\",\"courses_java_01-java语法入门_05-变量和常量.md\":\"wVbb047E\",\"categories_solutions_2021_11_22_一条sql查询今年每月统计信息.md\":\"2pLzv9Tp\",\"categories_issues_2022_08_11_执行shell脚本报java command not found.md\":\"M4ZLKe1m\",\"categories_issues_2022_11_04_解决docker安装prometheus启动报错的问题.md\":\"wlwkdFKi\",\"categories_tools_2021_03_04_ardm快速入门.md\":\"zbxPd0TS\",\"courses_java_01-java语法入门_12-程序调试入门.md\":\"1LT3Uu5K\",\"categories_solutions_index.md\":\"JPFJaff4\",\"categories_solutions_2021_11_18_用java8获取近n天日期.md\":\"r9mp3BOr\",\"categories_tools_2021_02_22_rdm快速入门.md\":\"-N1bZYLN\",\"courses_mysql_index.md\":\"6rziEA5O\",\"categories_tools_2021_01_14_初识lombok.md\":\"DDRTdFdf\",\"categories_tools_2021_03_10_quartz快速入门.md\":\"yXxsG68Z\",\"courses_mybatis_index.md\":\"7LMzFTpl\",\"courses_java_01-java语法入门_08-if选择结构.md\":\"GylQ89V9\",\"categories_solutions_2022_09_07_递归查询树型结构数据的性能优化方案.md\":\"zWro2Zfo\",\"courses_java_01-java语法入门_13-一维数组.md\":\"tyF-2IM9\",\"courses_java_01-java语法入门_11-多重循环.md\":\"79go9ddo\",\"courses_java_01-java语法入门_10-循环结构.md\":\"z73Bcwe8\",\"courses_java_01-java语法入门_09-switch选择结构.md\":\"p1ZypRLa\",\"tags.md\":\"TML_Ecph\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"zh-CN\",\"dir\":\"ltr\",\"title\":\"查尔斯的知识库\",\"description\":\"个人技术知识库,记录 & 分享个人碎片化、结构化、体系化的技术知识内容。\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"我的分类\",\"items\":[{\"text\":\"Bug万象集\",\"link\":\"/categories/issues/index\",\"activeMatch\":\"/categories/issues/\"},{\"text\":\"\\\"杂碎\\\"逆袭史\",\"link\":\"/categories/fragments/index\",\"activeMatch\":\"/categories/fragments/\"},{\"text\":\"工具四海谈\",\"link\":\"/categories/tools/index\",\"activeMatch\":\"/categories/tools/\"},{\"text\":\"方案春秋志\",\"link\":\"/categories/solutions/index\",\"activeMatch\":\"/categories/solutions/\"}],\"activeMatch\":\"/categories/\"},{\"text\":\"我的小册\",\"items\":[{\"text\":\"Java基础快速入门\",\"link\":\"/courses/java/index\",\"activeMatch\":\"/courses/java/\"},{\"text\":\"MySQL快速入门\",\"link\":\"/courses/mysql/index\",\"activeMatch\":\"/courses/mysql/\"},{\"text\":\"MyBatis快速入门\",\"link\":\"/courses/mybatis/index\",\"activeMatch\":\"/courses/mybatis/\"}],\"activeMatch\":\"/courses/\"},{\"text\":\"我的标签\",\"link\":\"/tags\",\"activeMatch\":\"/tags\"},{\"text\":\"我的归档\",\"link\":\"/archives\",\"activeMatch\":\"/archives\"},{\"text\":\"关于\",\"items\":[{\"text\":\"关于知识库\",\"link\":\"/about/index\",\"activeMatch\":\"/about/index\"},{\"text\":\"关于我\",\"link\":\"/about/me\",\"activeMatch\":\"/about/me\"}],\"activeMatch\":\"/about/\"}],\"sidebar\":{\"/categories/issues/\":[{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/tiger.svg\\\" title=\\\"虎年\\\" alt=\\\"生肖\\\">\\n 2022年 (12篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>解决 Maven 传递依赖污染的问题\",\"link\":\"/categories/issues/2022/11/23/解决Maven传递依赖污染的问题\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>解决 DotNet 安装完报错Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again\",\"link\":\"/categories/issues/2022/11/06/解决DotNET安装后报错的问题\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>解决 Docker 安装 Prometheus 启动报 permission denied 的问题\",\"link\":\"/categories/issues/2022/11/04/解决Docker安装Prometheus启动报错的问题\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>Docker 设置网络代理\",\"link\":\"/categories/issues/2022/10/29/Docker设置网络代理\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>解决 CentOS 8 执行 yum install 报 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist 的问题\",\"link\":\"/categories/issues/2022/10/25/解决CentOS8执行yum安装报错\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">6</div>解决 Windows 桌面部分快捷方式图标变为空白的问题\",\"link\":\"/categories/issues/2022/10/15/解决Windows桌面部分快捷方式图标变为空白的问题\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">7</div>解决无法重复读取请求体和响应体的问题\",\"link\":\"/categories/issues/2022/09/23/解决无法重复读取请求体和响应体的问题\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">8</div>Nginx转发请求报13Permission denied错误\",\"link\":\"/categories/issues/2022/09/05/Nginx转发请求报13Permission denied错误\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">9</div>SpringBoot项目引入OpenFeign后无法启动\",\"link\":\"/categories/issues/2022/08/31/SpringBoot项目引入OpenFeign后无法启动\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">10</div>执行Shell脚本报java: command not found\",\"link\":\"/categories/issues/2022/08/11/执行Shell脚本报java command not found\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">11</div>创建一个自身类的静态对象变量,究竟会如何执行?\",\"link\":\"/categories/issues/2022/03/24/创建一个自身类的静态对象变量,究竟会如何执行?\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">12</div>JavaScript 无法存储 Java Long 类型数据问题\",\"link\":\"/categories/issues/2022/01/26/JavaScript 无法存储 Java Long 类型数据问题\"}],\"collapsed\":false},{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/ox.svg\\\" title=\\\"牛年\\\" alt=\\\"生肖\\\">\\n 2021年 (5篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>无法访问 F:\\\\。文件或目录损坏且无法读取。\",\"link\":\"/categories/issues/2021/12/13/无法访问F盘。文件或目录损坏且无法读取\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>SQL 注入攻击风险\",\"link\":\"/categories/issues/2021/12/11/SQL 注入攻击风险\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration\",\"link\":\"/categories/issues/2021/12/10/Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>for循环中删除集合元素隐藏的陷阱\",\"link\":\"/categories/issues/2021/12/08/for循环中删除集合元素隐藏的陷阱\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>F:\\\\ 上的回收站已损坏。是否清空该驱动器上的\\\"回收站\\\"?\",\"link\":\"/categories/issues/2021/12/01/F盘上的回收站已损坏。是否清空该驱动器上的回收站\"}],\"collapsed\":true}],\"/categories/fragments/\":[{\"text\":\"<svg style=\\\"display: inline-block; vertical-align: middle; padding-bottom: 3px;\\\" viewBox=\\\"0 0 1920 1024\\\" version=\\\"1.1\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"30\\\" height=\\\"30\\\"><path d=\\\"M367.488 667.904h423.744v47.232H367.488v-47.232zM320.256 204.352h137.28v68.992h-137.28v-68.992zM367.488 754.112h423.744v48H367.488v-48zM693.76 204.352h137.984v68.992H693.76v-68.992zM507.008 204.352h137.28v68.992h-137.28v-68.992z\\\" p-id=\\\"10749\\\" fill=\\\"#d81e06\\\"></path><path d=\\\"M1792.512 0H127.488C57.472 0 0 57.152 0 127.616v768.768C0 966.72 57.088 1024 127.488 1024h1665.088c69.952 0 127.424-57.152 127.424-127.616V127.616C1920 57.216 1862.912 0 1792.512 0z m-528 175.104h446.976v54.016H1494.72l-24 101.248h206.976V689.6h-57.728V384.32h-289.472v308.224h-57.728v-362.24h140.224l20.992-101.248h-169.472v-53.952z m-996.032-11.2h614.272v167.232h-51.008v-17.28H320.256v17.28H268.48V163.904z m678.784 681.728h-744v-43.52h111.744V454.848h229.504v-48.704H221.248v-42.048h323.264v-39.744h54.016v39.744h331.52v41.984h-331.52v48.768h245.248v347.264h103.488v43.52z m203.264-94.528c0 59.52-30.72 89.28-92.224 89.28-25.472 0-46.016-0.512-61.504-1.472-2.496-22.976-6.528-45.248-12.032-66.752 22.976 5.504 46.72 8.256 71.232 8.256 24 0 35.968-11.52 35.968-34.496V247.872H971.2v-54.72h278.976v54.72H1150.4v503.232z m521.216 121.536c-67.008-55.488-137.28-108.032-210.752-157.504-4.992 9.984-10.496 19.008-16.512 27.008-41.472 57.024-113.28 101.504-215.232 133.504-9.472-16.512-21.504-34.496-35.968-54.016 94.528-27.008 161.28-64.512 200.256-112.512 34.496-44.992 51.776-113.024 51.776-204.032V421.12h57.728v82.496c0 62.528-6.72 115.776-20.224 159.744 84.48 54.016 161.472 107.008 230.976 158.976l-42.048 50.304z\\\" p-id=\\\"10750\\\" fill=\\\"#d81e06\\\"></path><path d=\\\"M367.488 495.36h423.744v47.232H367.488V495.36zM367.488 581.632h423.744v47.232H367.488v-47.232z\\\" p-id=\\\"10751\\\" fill=\\\"#d81e06\\\"></path></svg>\\n 我的置顶 (8篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>个人常用快捷键\",\"link\":\"/categories/fragments/2022/10/06/个人常用快捷键\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>个人常用 Git 命令\",\"link\":\"/categories/fragments/2022/10/05/个人常用Git命令\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>个人常用 Docker 命令\",\"link\":\"/categories/fragments/2022/10/01/个人常用Docker命令\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>个人常用 SQL 函数\",\"link\":\"/categories/fragments/2022/02/16/个人常用SQL函数\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>个人常用 Linux 命令\",\"link\":\"/categories/fragments/2019/12/31/个人常用Linux命令\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">6</div>个人常用 Hutool 工具类\",\"link\":\"/categories/fragments/2019/12/30/个人常用Hutool工具类\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">7</div>个人常用 Stream 使用技巧\",\"link\":\"/categories/fragments/2019/12/29/个人常用Stream使用技巧\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">8</div>个人 SQL 优化技巧\",\"link\":\"/categories/fragments/2019/12/28/个人SQL优化技巧\"}],\"collapsed\":false},{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/rabbit.svg\\\" title=\\\"兔年\\\" alt=\\\"生肖\\\">\\n 2023年 (2篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>一文详解限流接口实现\",\"link\":\"/categories/fragments/2023/12/21/一文详解限流接口实现\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>阿里巴巴的Code Review方法论与实践总结\",\"link\":\"/categories/fragments/2023/01/06/CodeReview方法论与实践总结\"}],\"collapsed\":false},{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/tiger.svg\\\" title=\\\"虎年\\\" alt=\\\"生肖\\\">\\n 2022年 (15篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>简单聊聊如何让网站开启灰色显示\",\"link\":\"/categories/fragments/2022/12/07/网站开启灰色显示\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>使用 IntelliJ IDEA 进行远程程序调试\",\"link\":\"/categories/fragments/2022/11/01/使用IDEA进行远程程序调试\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>CentOS 安装 Docker、Docker Compose\",\"link\":\"/categories/fragments/2022/10/31/CentOS安装Docker\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>Docker 安装 MinIO 详细步骤\",\"link\":\"/categories/fragments/2022/10/28/Docker安装MinIO\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>Docker 安装 Consul 详细步骤\",\"link\":\"/categories/fragments/2022/10/27/Docker安装Consul\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">6</div>Docker 安装 OpenLDAP 详细步骤\",\"link\":\"/categories/fragments/2022/10/26/Docker安装OpenLDAP\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">7</div>个人常用快捷键\",\"link\":\"/categories/fragments/2022/10/06/个人常用快捷键\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">8</div>个人常用 Git 命令\",\"link\":\"/categories/fragments/2022/10/05/个人常用Git命令\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">9</div>个人常用 Docker 命令\",\"link\":\"/categories/fragments/2022/10/01/个人常用Docker命令\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">10</div>内网CentOS服务器设置网络代理\",\"link\":\"/categories/fragments/2022/08/29/内网CentOS服务器设置网络代理\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">11</div>为指定Git仓库单独配置用户名和邮箱\",\"link\":\"/categories/fragments/2022/03/28/为指定Git仓库单独配置用户名和邮箱\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">12</div>修改Git所有提交记录中的作者和邮箱\",\"link\":\"/categories/fragments/2022/03/27/修改Git所有提交记录中的作者和邮箱\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">13</div>修改Git最后一次提交记录的作者和邮箱\",\"link\":\"/categories/fragments/2022/03/26/修改Git最后一次提交记录的作者和邮箱\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">14</div>合并两个Git仓库的历史提交记录\",\"link\":\"/categories/fragments/2022/03/25/合并两个Git仓库的历史提交记录\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">15</div>个人常用 SQL 函数\",\"link\":\"/categories/fragments/2022/02/16/个人常用SQL函数\"}],\"collapsed\":true},{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/ox.svg\\\" title=\\\"牛年\\\" alt=\\\"生肖\\\">\\n 2021年 (2篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>设计模式之单例模式\",\"link\":\"/categories/fragments/2021/05/29/设计模式之单例模式\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>精密计算工具类-BigDecimal\",\"link\":\"/categories/fragments/2021/03/12/精密计算工具类-BigDecimal\"}],\"collapsed\":true},{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/pig.svg\\\" title=\\\"猪年\\\" alt=\\\"生肖\\\">\\n 2019年 (4篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>个人常用 Linux 命令\",\"link\":\"/categories/fragments/2019/12/31/个人常用Linux命令\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>个人常用 Hutool 工具类\",\"link\":\"/categories/fragments/2019/12/30/个人常用Hutool工具类\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>个人常用 Stream 使用技巧\",\"link\":\"/categories/fragments/2019/12/29/个人常用Stream使用技巧\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>个人 SQL 优化技巧\",\"link\":\"/categories/fragments/2019/12/28/个人SQL优化技巧\"}],\"collapsed\":true}],\"/categories/solutions/\":[{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/tiger.svg\\\" title=\\\"虎年\\\" alt=\\\"生肖\\\">\\n 2022年 (1篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>递归查询树型结构数据的性能优化方案\",\"link\":\"/categories/solutions/2022/09/07/递归查询树型结构数据的性能优化方案\"}],\"collapsed\":false},{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/ox.svg\\\" title=\\\"牛年\\\" alt=\\\"生肖\\\">\\n 2021年 (2篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>一条SQL查询今年每月统计信息\",\"link\":\"/categories/solutions/2021/11/22/一条SQL查询今年每月统计信息\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>用Java8获取近N天日期\",\"link\":\"/categories/solutions/2021/11/18/用Java8获取近N天日期\"}],\"collapsed\":true}],\"/categories/tools/\":[{\"text\":\"<img class=\\\"chinese-zodiac\\\" style=\\\"position: static; vertical-align: middle; padding-bottom: 3px;\\\" src=\\\"/img/svg/chinese-zodiac/ox.svg\\\" title=\\\"牛年\\\" alt=\\\"生肖\\\">\\n 2021年 (5篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>Quartz 快速入门\",\"link\":\"/categories/tools/2021/03/10/Quartz快速入门\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>Postman 快速入门\",\"link\":\"/categories/tools/2021/03/06/Postman快速入门\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>Another Redis Desktop Manager 快速入门\",\"link\":\"/categories/tools/2021/03/04/ARDM快速入门\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>Redis Desktop Manager 快速入门\",\"link\":\"/categories/tools/2021/02/22/RDM快速入门\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>初识 Lombok\",\"link\":\"/categories/tools/2021/01/14/初识Lombok\"}],\"collapsed\":false}],\"/courses/java/\":[{\"text\":\"Java语法入门 (14篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>开发环境搭建\",\"link\":\"/courses/java/01-Java语法入门/01-开发环境搭建\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>第一个Java程序\",\"link\":\"/courses/java/01-Java语法入门/02-第一个Java程序\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>初识Eclipse\",\"link\":\"/courses/java/01-Java语法入门/03-初识Eclipse\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>程序和计算机的那点事儿\",\"link\":\"/courses/java/01-Java语法入门/04-程序和计算机的那点事儿\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>变量和常量\",\"link\":\"/courses/java/01-Java语法入门/05-变量和常量\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">6</div>常用的运算符\",\"link\":\"/courses/java/01-Java语法入门/06-常用的运算符\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">7</div>控制语句和流程图\",\"link\":\"/courses/java/01-Java语法入门/07-控制语句和流程图\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">8</div>if选择结构\",\"link\":\"/courses/java/01-Java语法入门/08-if选择结构\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">9</div>switch选择结构\",\"link\":\"/courses/java/01-Java语法入门/09-switch选择结构\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">10</div>循环结构\",\"link\":\"/courses/java/01-Java语法入门/10-循环结构\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">11</div>多重循环\",\"link\":\"/courses/java/01-Java语法入门/11-多重循环\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">12</div>程序调试入门\",\"link\":\"/courses/java/01-Java语法入门/12-程序调试入门\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">13</div>一维数组\",\"link\":\"/courses/java/01-Java语法入门/13-一维数组\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">14</div>多维数组\",\"link\":\"/courses/java/01-Java语法入门/14-多维数组\"}],\"collapsed\":false},{\"text\":\"Java面向对象 (1篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>类和对象\",\"link\":\"/courses/java/02-Java面向对象/01-类和对象\"}],\"collapsed\":true},{\"text\":\"Java高级特性 (1篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>集合与泛型-1\",\"link\":\"/courses/java/03-Java高级特性/01-集合与泛型-1\"}],\"collapsed\":true},{\"text\":\"附录 (1篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>CentOS 8.2 安装 JDK 1.8.0_202\",\"link\":\"/courses/java/04-附录/01-CentOS安装JDK\"}],\"collapsed\":true}],\"/courses/mysql/\":[{\"text\":\"MySQL基础 (1篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>MySQL安装与配置\",\"link\":\"/courses/mysql/01-MySQL基础/01-MySQL安装与配置\"}],\"collapsed\":true},{\"text\":\"附录 (2篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>CentOS 8.2 安装 MySQL 5.7.39\",\"link\":\"/courses/mysql/03-附录/01-CentOS安装MySQL\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>Docker 安装 MySQL 详细步骤\",\"link\":\"/courses/mysql/03-附录/02-Docker安装MySQL\"}],\"collapsed\":false}],\"/courses/mybatis/\":[{\"text\":\"MyBatis基础 (8篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>快速入门\",\"link\":\"/courses/mybatis/01-MyBatis基础/01-快速入门\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>核心对象\",\"link\":\"/courses/mybatis/01-MyBatis基础/02-核心对象\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>核心配置文件\",\"link\":\"/courses/mybatis/01-MyBatis基础/03-核心配置文件\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>SQL映射文件之查询元素\",\"link\":\"/courses/mybatis/01-MyBatis基础/04-SQL映射文件之查询元素\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>SQL映射文件之增删改元素\",\"link\":\"/courses/mybatis/01-MyBatis基础/05-SQL映射文件之增删改元素\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">6</div>SQL映射文件之自定义映射元素\",\"link\":\"/courses/mybatis/01-MyBatis基础/06-SQL映射文件之自定义映射元素\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">7</div>SQL映射文件之缓存元素\",\"link\":\"/courses/mybatis/01-MyBatis基础/07-SQL映射文件之缓存元素\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">8</div>动态SQL\",\"link\":\"/courses/mybatis/01-MyBatis基础/08-动态SQL\"}],\"collapsed\":false},{\"text\":\"MyBatis-Plus基础 (5篇)\",\"items\":[{\"text\":\"<div class=\\\"text-color-red mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">1</div>快速入门\",\"link\":\"/courses/mybatis/02-MyBatis-Plus基础/01-快速入门\"},{\"text\":\"<div class=\\\"text-color-orange mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">2</div>增删改操作\",\"link\":\"/courses/mybatis/02-MyBatis-Plus基础/02-增删改操作\"},{\"text\":\"<div class=\\\"text-color-yellow mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">3</div>简单查询操作\",\"link\":\"/courses/mybatis/02-MyBatis-Plus基础/03-简单查询操作\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">4</div>条件构造器\",\"link\":\"/courses/mybatis/02-MyBatis-Plus基础/04-条件构造器\"},{\"text\":\"<div class=\\\"text-color-gray mr-[6px]\\\" style=\\\"font-weight: 550; display: inline-block;\\\">5</div>代码生成器\",\"link\":\"/courses/mybatis/02-MyBatis-Plus基础/05-代码生成器\"}],\"collapsed\":false}]},\"logo\":\"/logo.png\",\"outline\":{\"level\":\"deep\",\"label\":\"目录\"},\"darkModeSwitchLabel\":\"切换日光/暗黑模式\",\"sidebarMenuLabel\":\"文章\",\"returnToTopLabel\":\"返回顶部\",\"lastUpdatedText\":\"最后更新\",\"docFooter\":{\"prev\":\"上一篇\",\"next\":\"下一篇\"},\"editLink\":{\"pattern\":\"https://github.com/Charles7c/charles7c.github.io/edit/main/docs/:path\",\"text\":\"不妥之处,敬请雅正\"},\"search\":{\"provider\":\"algolia\",\"options\":{\"appId\":\"DBZ0G9HBUY\",\"apiKey\":\"00cef480a543003d05d9808110ea5f65\",\"indexName\":\"charles7c\",\"locales\":{\"root\":{\"placeholder\":\"搜索文档\",\"translations\":{\"button\":{\"buttonText\":\"搜索文档\",\"buttonAriaLabel\":\"搜索文档\"},\"modal\":{\"searchBox\":{\"resetButtonTitle\":\"清除查询条件\",\"resetButtonAriaLabel\":\"清除查询条件\",\"cancelButtonText\":\"取消\",\"cancelButtonAriaLabel\":\"取消\"},\"startScreen\":{\"recentSearchesTitle\":\"搜索历史\",\"noRecentSearchesText\":\"没有搜索历史\",\"saveRecentSearchButtonTitle\":\"保存至搜索历史\",\"removeRecentSearchButtonTitle\":\"从搜索历史中移除\",\"favoriteSearchesTitle\":\"收藏\",\"removeFavoriteSearchButtonTitle\":\"从收藏中移除\"},\"errorScreen\":{\"titleText\":\"无法获取结果\",\"helpText\":\"你可能需要检查你的网络连接\"},\"footer\":{\"selectText\":\"选择\",\"navigateText\":\"切换\",\"closeText\":\"关闭\",\"searchByText\":\"搜索提供者\"},\"noResultsScreen\":{\"noResultsText\":\"无法找到相关结果\",\"suggestedQueryText\":\"你可以尝试查询\",\"reportMissingResultsText\":\"你认为该查询应该有结果?\",\"reportMissingResultsLinkText\":\"点击反馈\"}}}}}}},\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/Charles7c/charles7c.github.io\"},{\"icon\":{\"svg\":\"<svg role=\\\"img\\\" viewBox=\\\"0 0 24 24\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\"><title>码云</title><path d=\\\"M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.15a.592.592 0 0 1-.592-.592v-1.482a.593.593 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H5.926a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h8.296Z\\\"/></svg>\"},\"link\":\"https://gitee.com/Charles7c/charles7c\"},{\"icon\":{\"svg\":\"<svg width=\\\"33\\\" height=\\\"33\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"0 0 174.8 204\\\">\\n <title>ContiNew Admin</title>\\n <path fill=\\\"#307AF2\\\" d=\\\"M86.7,0l88,51v.2l-16.3,9.4v-.2L86.7,18.9Zm71.8,143.5,16.3,9.4v.2L86.8,204h0l-16.3-9.4,16.3-9.4h0l71.7-41.5v-.2Z\\\"/>\\n <path fill=\\\"#12D2AC\\\" d=\\\"M16.3,143.5v.2L58,167.8l-16.3,9.4L0,153.1v-.2Z\\\"/>\\n <path fill=\\\"#12D2AC\\\" d=\\\"M104.1,93,15.9,143.8l-.2-.1V124.9l.2.1L87.7,83.6,104.1,93Z\\\"/>\\n <path fill=\\\"#0057FE\\\" d=\\\"M88.1,0,.1,51v.2l16.3,9.4v-.2L88.1,18.9Z\\\"/>\\n <path fill=\\\"#307AF2\\\" d=\\\"M.1,50.9.2,152.6l.2.1,16.3-9.4-.2-.1-.1-82.9L.1,50.9Z\\\"/>\\n <path fill=\\\"#0057FE\\\" d=\\\"M174.7,50.9l-.1,101.7-.2.1-16.3-9.4.2-.1.1-82.9Z\\\"/>\\n <path fill=\\\"#12D2AC\\\" d=\\\"M41.7,158.5l16.1,9.4,100.6-58.7V90.4Z\\\"/>\\n </svg>\"},\"link\":\"https://cnadmin.charles7c.top/\"}],\"articleMetadataConfig\":{\"author\":\"查尔斯\",\"authorLink\":\"/about/me\",\"showViewCount\":false},\"copyrightConfig\":{\"license\":\"署名-相同方式共享 4.0 国际 (CC BY-SA 4.0)\",\"licenseLink\":\"http://creativecommons.org/licenses/by-sa/4.0/\"},\"commentConfig\":{\"type\":\"gitalk\",\"showComment\":true},\"footerConfig\":{\"showFooter\":true,\"icpRecordCode\":\"津ICP备2022005864号-2\",\"publicSecurityRecordCode\":\"津公网安备12011202000677号\",\"copyright\":\"Copyright © 2019-2024 Charles7c\"}},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":true}");</script>
</body>
</html>