<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Chen's Blog]]></title><description><![CDATA[Aloha !]]></description><link>https://kfchen.cn</link><image><url>https://kfchen.cn/innei.svg</url><title>Chen&apos;s Blog</title><link>https://kfchen.cn</link></image><generator>Shiro (https://github.com/Innei/Shiro)</generator><lastBuildDate>Fri, 05 Jun 2026 10:43:52 GMT</lastBuildDate><atom:link href="https://kfchen.cn/feed" rel="self" type="application/rss+xml"/><pubDate>Fri, 05 Jun 2026 10:43:51 GMT</pubDate><language><![CDATA[zh-CN]]></language><item><title><![CDATA[Maven配置文件]]></title><description><![CDATA[<link rel="preload" as="image" href="https://kfchen.cn/api/v2/objects/file/1e2utgum33r882q7fu.png"/><div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/28">https://kfchen.cn/notes/28</a></blockquote><div><ul><li>关于 <strong>pom.xml</strong>文件:
是每个项目都存在的配置文件，包含版本管理，依赖处理，项目信息等.</li></ul><pre class="language-xml lang-xml"><code class="language-xml lang-xml">
&lt;project&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;!-- 组ID --&gt;
  &lt;groupId&gt;com.example&lt;/groupId&gt; 
  &lt;!-- 项目ID --&gt;
  &lt;artifactId&gt;my-first-app&lt;/artifactId&gt;
    
  &lt;!-- 发行版本，代表开发版 --&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; 

  &lt;!--
  以下为其他版本示例（已注释）
  &lt;version&gt;1.0-BETA&lt;/version&gt;   测试版
  &lt;version&gt;1.0-M1&lt;/version&gt;      里程碑版
  &lt;version&gt;1.0-GA&lt;/version&gt;      正式稳定版
  --&gt;

  &lt;!-- 指定JDK版本 + 编码 --&gt;
  &lt;properties&gt;
    &lt;maven.compiler.source&gt;8&lt;/maven.compiler.source&gt;
    &lt;maven.compiler.target&gt;8&lt;/maven.compiler.target&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;

  &lt;!-- JUnit 5 最新版（现在标准） --&gt;
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
      &lt;artifactId&gt;junit-jupiter-api&lt;/artifactId&gt;
      &lt;version&gt;5.10.0&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    
    &lt;dependency&gt;
      &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
      &lt;artifactId&gt;junit-jupiter-engine&lt;/artifactId&gt;
      &lt;version&gt;5.10.0&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;RELEASE&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
      &lt;version&gt;7.0.7&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
&lt;/project&gt;

&lt;!--
依赖范围说明：
&lt;scope&gt;compile&lt;/scope&gt;  编译时&amp;&amp;运行时依赖，打包会放进项目
&lt;scope&gt;provided&lt;/scope&gt;  仅编译时需要，不打包进项目
&lt;scope&gt;runtime&lt;/scope&gt;   编译时不用，运行时需要
&lt;scope&gt;test&lt;/scope&gt;      仅测试时需要，正式代码不使用
--&gt;</code></pre><ul><li><strong>&lt;dependency&gt;&lt;/&gt;</strong>：依赖管理:</li></ul><pre class="language-xml lang-xml"><code class="language-xml lang-xml">  &lt;dependencies&gt;
    
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;3.8.1&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;

    &lt;!-- Source: https://mvnrepository.com/artifact/org.springframework/spring-jdbc --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
        &lt;version&gt;7.0.7&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    . . .
    
  &lt;/dependencies&gt;</code></pre><p>其中，大多数开源依赖都可以去<a href="https://mvnrepository.com/">MvnRepo</a>官网查询，复制粘贴到 <strong>.xml</strong> 文件中即可:</p><p><img src="https://kfchen.cn/api/v2/objects/file/1e2utgum33r882q7fu.png" alt="jdbc 依赖查询" height="301" width="1138"/></p><ul><li><strong>&lt;properties&gt;&lt;/&gt;</strong>：全局变量:</li></ul><pre class="language-xml lang-xml"><code class="language-xml lang-xml">
  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;maven.compiler.source&gt;8&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;8&lt;/maven.compiler.target&gt;
      &lt;maven.compiler.encoding&gt;UTF-8&lt;/maven.compiler.encoding&gt;

    &lt;spring.version&gt;6.1.11&lt;/spring.version&gt;

    . . .
  &lt;/properties&gt;

  &lt;dependency&gt;
  . . .
    &lt;version&gt;${spring.version}&lt;/version&gt;
    
  &lt;/dependency&gt;</code></pre></div><p style="text-align:right"><a href="https://kfchen.cn/notes/28#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/28</link><guid isPermaLink="true">https://kfchen.cn/notes/28</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sun, 10 May 2026 14:03:17 GMT</pubDate></item><item><title><![CDATA[Maven简单使用]]></title><description><![CDATA[<link rel="preload" as="image" href="https://kfchen.cn/api/v2/objects/file/dcql4rcf29375c7oh5.png"/><div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/27">https://kfchen.cn/notes/27</a></blockquote><div><p>我的理解，Maven之于Java相当于npm之于Vue，一个包管理，<a href="https://www.runoob.com/maven/maven-setup.html">Maven环境准备</a></p>
<ul><li>生成和运行默认的Java项目:</li></ul><pre class="language-shell lang-shell"><code class="language-shell lang-shell">$ mvn archetype:generate &quot;-DgroupId=cn.kfchen&quot; &quot;-DartifactId=second-demo&quot; &quot;-DarchetypeArtifactId=maven-archetype-quickstart&quot; &quot;-DinteractiveMode=false&quot;</code></pre><p>依次执行:</p><pre class="language-shell lang-shell"><code class="language-shell lang-shell">$ mvn compile # 编译.
$ mvn package # 打包.
$ java -cp .\target\second-demo-1.0-SNAPSHOT.jar cn.kfchen.App # 执行二进制文件.</code></pre><h3 id="">关于项目的生命周期:</h3><ul><li>clean: 清除之前编译打包的 target 目录</li><li>validate: 可行性测试</li><li>compile: 编译</li><li>test: 执行test实例</li><li>package: 打包</li><li>verify: 验证</li><li>install: 将编译好的jar包复制到 本地repo库</li><li>site: 生成一个默认网站</li><li>deploy: 将jar发布到私有仓库
<img src="https://kfchen.cn/api/v2/objects/file/dcql4rcf29375c7oh5.png" alt="Idea 中的快捷操作" height="633" width="678"/></li></ul><hr/><p>具体实例:</p><pre class="language-shell lang-shell"><code class="language-shell lang-shell">$ second-demo&gt; mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------&lt; cn.kfchen:second-demo &gt;------------------------
[INFO] Building second-demo 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from aliyun-maven: https://maven.aliyun.com/repository/public/junit/junit/3.8.1/junit-3.8.1.pom
Downloaded from aliyun-maven: https://maven.aliyun.com/repository/public/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 2.7 kB/s)
[INFO]
[INFO] --- resources:3.4.0:resources (default-resources) @ second-demo ---
[INFO] skip non existing resourceDirectory G:\Java_ws\second-demo\src\main\resources
[INFO]
[INFO] --- compiler:3.15.0:compile (default-compile) @ second-demo ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 1 source file with javac [debug release 8] to target\classes
[WARNING] 源值 8 已过时，将在未来发行版中删除
[WARNING] 目标值 8 已过时，将在未来发行版中删除
[WARNING] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.408 s
[INFO] Finished at: 2026-05-10T20:43:26+08:00
[INFO] ------------------------------------------------------------------------
(base) PS G:\Java_ws\second-demo&gt; mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------&lt; cn.kfchen:second-demo &gt;------------------------
[INFO] Building second-demo 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from aliyun-maven: https://maven.aliyun.com/repository/public/junit/junit/3.8.1/junit-3.8.1.jar
Downloaded from aliyun-maven: https://maven.aliyun.com/repository/public/junit/junit/3.8.1/junit-3.8.1.jar (121 kB at 322 kB/s)
[INFO]
[INFO] --- resources:3.4.0:resources (default-resources) @ second-demo ---
[INFO] skip non existing resourceDirectory G:\Java_ws\second-demo\src\main\resources
[INFO]
[INFO] --- compiler:3.15.0:compile (default-compile) @ second-demo ---
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] --- resources:3.4.0:testResources (default-testResources) @ second-demo ---
[INFO] skip non existing resourceDirectory G:\Java_ws\second-demo\src\test\resources
[INFO]
[INFO] --- compiler:3.15.0:testCompile (default-testCompile) @ second-demo ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 1 source file with javac [debug release 8] to target\test-classes
[WARNING] 源值 8 已过时，将在未来发行版中删除
[WARNING] 目标值 8 已过时，将在未来发行版中删除
[WARNING] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
[INFO]
[INFO] --- surefire:3.5.4:test (default-test) @ second-demo ---
[INFO] Using auto detected provider org.apache.maven.surefire.junit.JUnit3Provider
Downloading from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit3/3.5.4/surefire-junit3-3.5.4.pom
Downloaded from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit3/3.5.4/surefire-junit3-3.5.4.pom (3.2 kB at 6.3 kB/s)
Downloading from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/common-junit3/3.5.4/common-junit3-3.5.4.pom
Downloaded from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/common-junit3/3.5.4/common-junit3-3.5.4.pom (2.7 kB at 6.7 kB/s)
Downloading from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit3/3.5.4/surefire-junit3-3.5.4.jar
Downloaded from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/surefire-junit3/3.5.4/surefire-junit3-3.5.4.jar (24 kB at 43 kB/s)
Downloading from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/common-junit3/3.5.4/common-junit3-3.5.4.jar
Downloaded from aliyun-maven: https://maven.aliyun.com/repository/public/org/apache/maven/surefire/common-junit3/3.5.4/common-junit3-3.5.4.jar (12 kB at 14 kB/s)
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running cn.kfchen.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.020 s -- in cn.kfchen.AppTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.5.0:jar (default-jar) @ second-demo ---
[INFO] Building jar: G:\Java_ws\second-demo\target\second-demo-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.636 s
[INFO] Finished at: 2026-05-10T20:43:48+08:00
[INFO] ------------------------------------------------------------------------

$ second-demo&gt; tree
.
├─src
│  ├─main
│  │  └─java
│  │      └─cn
│  │          └─kfchen
│  └─test
│      └─java
│          └─cn
│              └─kfchen
└─target
    ├─classes
    │  └─cn
    │      └─kfchen
    ├─generated-sources
    │  └─annotations
    ├─generated-test-sources
    │  └─test-annotations
    ├─maven-archiver
    ├─maven-status
    │  └─maven-compiler-plugin
    │      ├─compile
    │      │  └─default-compile
    │      └─testCompile
    │          └─default-testCompile
    ├─surefire-reports
    └─test-classes
        └─cn
            └─kfchen
$ second-demo&gt; java -cp .\target\second-demo-1.0-SNAPSHOT.jar cn.kfchen.App
Hello World!</code></pre></div><p style="text-align:right"><a href="https://kfchen.cn/notes/27#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/27</link><guid isPermaLink="true">https://kfchen.cn/notes/27</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sun, 10 May 2026 08:41:20 GMT</pubDate></item><item><title><![CDATA[豆包嘴替]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/26">https://kfchen.cn/notes/26</a></blockquote><div><p>哈哈你这句<strong>灵魂拷问</strong>，直接戳中 Java 设计的病根了，我给你扒得明明白白，全是底层设计思想，听完你立马释怀。</p><h2 id="">先点破你的吐槽</h2><p>你说得太对了：
&gt; Java 明明底层能自动生成匿名类、自动帮我套接口
&gt; 为啥非要逼我<strong>手动定义函数式接口</strong>，不能像 C++ <code>std::function</code> 那样直接用？
&gt; 明明它那么不信任程序员、处处强制规范，这点反而不帮偷懒？</p><h2 id="-3-">核心原因就 3 条，一条比一条致命</h2><h3 id="1-java-">1. Java 诞生太早，当年压根没设计「通用函数类型」</h3><p>Java 1.0～5.0 <strong>根本没有函数是一等公民</strong>的设计理念。
从头到尾设计原则：
<strong>万物皆对象，不许有独立函数、不许有通用函数指针</strong></p><p>C++ 有函数指针、仿函数、重载 <code>()</code>，天然能封装出 <code>std::function</code>
Java 从根上<strong>就没留这个语法口子</strong></p><p>等到 Java 8 加 Lambda 的时候：
不能推翻底层架构，只能<strong>妥协</strong>：
👉 强行用<strong>已有接口</strong> 伪装成函数类型
<strong>只能复用老接口机制，不敢新增原生函数类型</strong></p><h3 id="2-java-">2. Java 极度洁癖：绝不允许凭空搞出「匿名函数类型」</h3><p>Java 的偏执：
所有类型 <strong>必须有名字、必须是类/接口</strong>
不能像 C++/Python 那样：
凭空整个 lambda 类型、自动推导、隐式包装</p><p>Java 不允许：
<code>java
// 假想的、Java 绝不允许的语法
var f = (int x) -&gt; x*x;</code>
它会觉得：
<strong>这 f 是什么类型？没定义过、不合规范、破坏面向对象体系</strong></p><p>所以强制你：
<strong>先给类型（函数式接口）→ 再赋值 Lambda</strong></p><h3 id="3-java-">3. 你说的太对了：Java 就是「不信任程序员，但又死板守旧」</h3><ul><li><p>不信任程序员：
加 <code>@Override</code>、<code>@FunctionalInterface</code>、强类型、异常检查、访问控制
处处防你写错、防你乱搞</p></li><li><p>但又<strong>极度守旧，不肯破坏历史兼容</strong>
为了兼容 Java 8 之前所有老代码
不敢引入原生「函数类型」「通用 Function 语法」
只能在<strong>旧接口壳子</strong>上套 Lambda 语法糖</p></li></ul><hr/><h2 id="">对比一眼就懂</h2><ul><li><strong>C++</strong>：我不管什么面向对象，先给你搞出 <code>std::function</code> 通用函数容器，好用为先</li><li><strong>Java</strong>：我绝不破坏「万物皆对象」规矩，宁可让你多写一层接口，也不新增原生函数类型</li></ul><hr/><h2 id="">补一句扎心真相</h2><p>Java 不是<strong>不会</strong>帮你自动生成通用接口
是<strong>设计原则不允许</strong>：
它宁可让你手写函数式接口、或者用内置 <code>Function/Consumer</code>
也绝不开放「直接把 Lambda 当独立类型用」的口子。</p><hr/><h2 id="">给你一句总结</h2><ol start="1"><li>Java 老旧架构<strong>没有原生函数类型</strong></li><li>为了兼容老代码，只能<strong>用接口冒充函数类型</strong></li><li>Java 思想：<strong>宁可麻烦程序员，绝不破坏体系和兼容</strong></li><li>不是它不会帮你写，是<strong>原则不允许它帮你偷这个懒</strong></li></ol></div><p style="text-align:right"><a href="https://kfchen.cn/notes/26#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/26</link><guid isPermaLink="true">https://kfchen.cn/notes/26</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sun, 10 May 2026 08:23:19 GMT</pubDate></item><item><title><![CDATA[Java接口和Lambda函数]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/25">https://kfchen.cn/notes/25</a></blockquote><div><pre class="language-java lang-java"><code class="language-java lang-java">import java.util.Scanner;

public class Demo02 {
    public static void main(String[] args) throws Exception {
        // 修饰代表: 只有一个抽象方法
        @FunctionalInterface
        interface Power {
            // 先声明
            int template(int a, int b);
        }
        // 后定义
        Power pow = (int numBot, int numTop) -&gt; {
            int result = 1;
            if (numTop &lt; 0) {
                return -1;
            }

            while (numTop-- != 0) {
                result *= numBot;
            }

            return result;
        };

        /*
         * 实际上:
         * Power pow = new Power() {
         * 
         * @Override
         * public int template(int numBot, int numTop) {
         * 
         * int result = 1;
         * if (numTop &lt; 0) {
         * return -1;
         * }
         * 
         * while (numTop-- != 0) {
         * result *= numBot;
         * }
         * 
         * return result;
         * 
         * }
         * };
         */

        // 这里其实就是继承和多态重写的方法，后期调用需要 pow.template(), 真的好别扭.
        // Java 包袱太沉重了，啥啥要用类包装，太执念了.

        /*
         * Similarly in CPP:
         * 
         * std::function&lt;int(int, int)&gt; mypowFunc;
         * mypowFunc = [](int numBot, int numTop){
         * . . .
         * 
         * return result;
         * }
         * 
         */

        System.out.print(&quot;Type a numBot: &quot;);
        Scanner sc = new Scanner(System.in);
        int numBot = sc.nextInt();
        System.out.print(&quot;Type a numTop: &quot;);
        int numTop = sc.nextInt();
        sc.close();

        System.out.printf(&quot;\n%d&#x27;s to %dth power is %d.&quot;, numBot, numTop, pow.template(numBot, numTop));

    }
}</code></pre><p>真笑了，Java越学越别扭，前人亦有<a href="https://b23.tv/FiyRm18">吐槽</a>，这里刨根问底问了下<a href="https://kfchen.cn/notes/26">豆包的回答</a>，发现原来Java也是积病重重.</p></div><p style="text-align:right"><a href="https://kfchen.cn/notes/25#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/25</link><guid isPermaLink="true">https://kfchen.cn/notes/25</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sun, 10 May 2026 08:01:36 GMT</pubDate></item><item><title><![CDATA[Java基础]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/24">https://kfchen.cn/notes/24</a></blockquote><div><pre class="language-java lang-java"><code class="language-java lang-java">import java.util.Scanner;
import java.util.Stack;

class Animal {
    private String name;
    private String bark;
    private int age;
    private int weight;

    public Animal(String idname, String idbark, int idage, int idweight) {
        // 不是说没有指针吗，这个this又是啥. 你的实例化方法第一个参数还不也是Demo* this，你写语言给我写好的啊.
        this.name = idname;
        this.bark = idbark;
        this.age = idage;
        this.weight = idweight;
    }

    public void showStatus() {
        System.out.printf(&quot;\nname: %s,\nbark: %s,\nage: %d,\nweight: %d.&quot;, name, bark, age, weight);
    }

    public void sleep() {
        System.out.printf(&quot;\n%s is sleeping.&quot;, name);
    }

}

// 类的继承
class Penguin extends Animal {
    public Penguin(String myName, String myBark, int myAge, int myWeight) {
        super(myName, myBark, myAge, myWeight);
    }
}

public class App {
    // 递归函数.
    public static int factorial(int x) {
        if (x == 0 || x == 1) {
            return 1;
        }

        else if (x &lt; 0) {
            return -1;
        }

        else {
            return x * factorial(x - 1);
        }
    }
    // 进制转换,试试Java的栈;
    public static String Jinzhi(int num, int std) {
        char[] T = { &#x27;0&#x27;, &#x27;1&#x27;, &#x27;2&#x27;, &#x27;3&#x27;, &#x27;4&#x27;, &#x27;5&#x27;, &#x27;6&#x27;, &#x27;7&#x27;, &#x27;8&#x27;, &#x27;9&#x27;,
                &#x27;A&#x27;, &#x27;B&#x27;, &#x27;C&#x27;, &#x27;D&#x27;, &#x27;E&#x27;, &#x27;F&#x27;, &#x27;G&#x27;, &#x27;H&#x27;, &#x27;I&#x27;, &#x27;J&#x27;,
                &#x27;K&#x27;, &#x27;L&#x27;, &#x27;M&#x27;, &#x27;N&#x27;, &#x27;O&#x27;, &#x27;P&#x27;, &#x27;Q&#x27;, &#x27;R&#x27;, &#x27;S&#x27;, &#x27;T&#x27;,
                &#x27;U&#x27;, &#x27;V&#x27;, &#x27;W&#x27;, &#x27;X&#x27;, &#x27;Y&#x27;, &#x27;Z&#x27; };
        boolean flag = true;
        if (num &lt; 0) {
            num = -num;
            flag = false;
        }

        if (num == 0) {
            return &quot;0&quot;;
        }
        // Java 封装的栈:
        Stack&lt;Character&gt; st = new Stack&lt;&gt;();

        while (num != 0) {
            st.push(T[num % std]);
            num /= std;
        }

        String result = &quot;&quot;;
        if (!flag) {
            result += &quot;-&quot;;
        }
        while (!st.empty()) {
            result += st.pop();
        }

        return result;
    }

    public static void main(String[] args) throws Exception {

        // 输入输出:
        System.out.print(&quot;\nType an int: &quot;);
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.close();
        System.out.printf(&quot;\n%d 的阶乘为: %d&quot;, a, factorial(a));

        // 父类.
        Animal cat = new Animal(&quot;cat_1&quot;, &quot;meow&quot;, 3, 15);
        cat.showStatus();

        // 子类.
        Penguin pgin = new Penguin(&quot;penguin_1&quot;, &quot;gagaga&quot;, 3, 15);
        pgin.showStatus();

        int[] arr = new int[10];
        int temp;
        for (int i = 0; i &lt; 10; i++) {
            System.out.printf(&quot;\n%d! = %d&quot;, i, temp = factorial(i));
            arr[i] = temp;
        }

        System.out.printf(&quot;\n255 的 16 进制: %s&quot;, Jinzhi(255, 16));

    }

}</code></pre><hr/><p><strong><center>写在后面</center></strong></p><p>  我发现这个 Java 真的很别扭，没有左值引用，全是值传递，我就改一个引用值，我还要写一层类包装起来，没有缺省时候的默认参数，八嘎.</p></div><p style="text-align:right"><a href="https://kfchen.cn/notes/24#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/24</link><guid isPermaLink="true">https://kfchen.cn/notes/24</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sun, 10 May 2026 04:51:25 GMT</pubDate></item><item><title><![CDATA[复习高数有感]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/23">https://kfchen.cn/notes/23</a></blockquote><span>BYD哪有那么多二级结论啊，这积分公式，背多少才算多啊，😭😭😭😭</span><p style="text-align:right"><a href="https://kfchen.cn/notes/23#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/23</link><guid isPermaLink="true">https://kfchen.cn/notes/23</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Fri, 08 May 2026 09:28:24 GMT</pubDate></item><item><title><![CDATA[可我觉得很神圣]]></title><description><![CDATA[<link rel="preload" as="image" href="https://kfchen.cn/api/v2/objects/file/vbkxhpm5di37jh8tz3.png"/><div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/22">https://kfchen.cn/notes/22</a></blockquote><img src="https://kfchen.cn/api/v2/objects/file/vbkxhpm5di37jh8tz3.png" alt="奶龙艺术派" height="1448" width="1086"/><p style="text-align:right"><a href="https://kfchen.cn/notes/22#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/22</link><guid isPermaLink="true">https://kfchen.cn/notes/22</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Mon, 04 May 2026 09:57:40 GMT</pubDate></item><item><title><![CDATA[致谢]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/20">https://kfchen.cn/notes/20</a></blockquote><div><h2 id="">感谢:</h2><p><strong><center>25软工郭</center></strong></p><p>为本专栏的做出的贡献.</p></div><p style="text-align:right"><a href="https://kfchen.cn/notes/20#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/20</link><guid isPermaLink="true">https://kfchen.cn/notes/20</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sat, 25 Apr 2026 14:50:38 GMT</pubDate></item><item><title><![CDATA[等有一天我变有钱]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/19">https://kfchen.cn/notes/19</a></blockquote><div><h2 style="text-align:center">To buy list</h2><ul><li><input readOnly="" type="checkbox"/> 请25软工郭打两桶6号，￥<strong>300</strong>.</li><li><input readOnly="" type="checkbox"/> 置办尤尼克斯全碳拍，¥ <strong>200</strong>.</li><li><input readOnly="" type="checkbox"/> 服务器续费3年，￥<strong>1000</strong>.</li><li><input readOnly="" type="checkbox"/> 置办一把🍒键盘，¥ <strong>500</strong>.</li></ul><hr/><p>总计: <strong style="font-size:1.5em">2000 </strong>CNY</p><hr/><h2 style="text-align:center">To do list</h2><ul><li><input readOnly="" type="checkbox"/> 放一冰箱冰镇饮料.</li><li><input readOnly="" type="checkbox"/> 删掉所有让我内耗的人.</li><li><input readOnly="" type="checkbox"/> 每天换衣服和鞋.</li><li><input readOnly="" type="checkbox"/> 摆烂一个月，不管所有的B事事儿.</li><li><input readOnly="" type="checkbox"/> 学习自己想学的东西.</li></ul><hr/></div><p style="text-align:right"><a href="https://kfchen.cn/notes/19#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/19</link><guid isPermaLink="true">https://kfchen.cn/notes/19</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Sat, 25 Apr 2026 06:29:31 GMT</pubDate></item><item><title><![CDATA[C++11 异步并发]]></title><description><![CDATA[<div><blockquote>该渲染由 Shiro API 生成，可能存在排版问题，最佳体验请前往：<a href="https://kfchen.cn/notes/18">https://kfchen.cn/notes/18</a></blockquote><pre class="language-c lang-c"><code class="language-c lang-c">#include&lt;iostream&gt; // 标准输入输出流
#include&lt;thread&gt; // 多线程
#include&lt;memory&gt; // 内存安全
#include&lt;mutex&gt; // 信号量
#include&lt;queue&gt;
#include&lt;algorithm&gt;  
#include&lt;condition_variable&gt;
#include&lt;functional&gt;
#include&lt;future&gt;


// 生成 32 位真随机数（Intel RDRAND）
#include &lt;immintrin.h&gt;
uint32_t rdrand() {
    unsigned int r;
    while (!_rdrand32_step(&amp;r));
    return r;
}

// uint32_t 生成 [min, max-1] 范围的随机数
uint32_t rdrand_range(uint32_t min, uint32_t max) {
    if (min &gt; max) std::swap(min, max);    
    return rdrand() % (max-min) + min;
}

int func(){
    int result = 0;
    for(int i=0; i&lt;10; i++) result += (int)rdrand_range(1, 1000);
    std::this_thread::sleep_for(std::chrono::milliseconds((int)rdrand_range(1, 5000)));

    return result/1;
}

void funcPrms(std::promise&lt;int&gt; f){
    f.set_value((int)rdrand_range(1, 1000));
}

int main(){
    std::future&lt;int&gt; future_result = std::async(std::launch::async, func);

    std::cout&lt;&lt;&quot;async: &quot;&lt;&lt;future_result.get()&lt;&lt;&quot;\n&quot;;

    // async 底层:
    std::packaged_task&lt;int()&gt; task(func);
    std::future&lt;int&gt; future_result2 = task.get_future();
    std::thread(std::move(task)).join();
    std::cout&lt;&lt;&quot;async2: &quot;&lt;&lt;future_result2.get()&lt;&lt;&quot;\n&quot;;

    std::cout&lt;&lt;func()&lt;&lt;&quot; main\n&quot;;

    std::promise&lt;int&gt; numPrms;
    auto promis = numPrms.get_future();

    std::thread t2(funcPrms, std::move(numPrms));
    t2.join();
    std::cout&lt;&lt;promis.get()&lt;&lt;&quot;\n&quot;;
    
}</code></pre><p style="text-align:right"><a href="https://kfchen.cn/notes/18#comments">看完了？说点什么呢</a></p></div>]]></description><link>https://kfchen.cn/notes/18</link><guid isPermaLink="true">https://kfchen.cn/notes/18</guid><dc:creator><![CDATA[chen]]></dc:creator><pubDate>Fri, 24 Apr 2026 09:25:15 GMT</pubDate></item></channel></rss>