栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

2021-10-25

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2021-10-25

空心金字塔

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        hollow();
        
    }

    public static void incline() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please input a integer: ");
        int totalLevel = scanner.nextInt();

        for (int i = 1; i <= totalLevel; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public static void solid() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please input a integer: ");
        int totalLevel = scanner.nextInt();

        for (int i = 1; i <= totalLevel; i++) {
            for (int j = 1; j <= totalLevel + i - 1; j++) {
                if (j <= totalLevel - i) {
                    System.out.print(" ");
                } else {
                    System.out.print("*");
                }
            }
            System.out.println();
        }
    }

    public static void hollow() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please input a integer: ");
        int totalLevel = scanner.nextInt();
        int totalStar = 2 * totalLevel - 1; // 误导

        for(int i = 1; i <= totalLevel; i++) {
            for (int j = 1; j <= totalLevel + i - 1; j++) {
                if (i == totalLevel) {
                    System.out.print("*");
                }

                

                // 逆向
                else if (j == totalLevel - i + 1 || j == totalLevel + i - 1) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }

            System.out.println();
        }
    }
}

// 三个图形,循序渐进

访问者模式
https://www.jianshu.com/p/1f1049d0a0f4

vue 跳转页面
https://www.jb51.net/article/183611.htm

java8 Stream
https://www.runoob.com/java/java8-streams.html

java8 LocalDateTime 格式化
https://blog.csdn.net/u014190164/article/details/82836607

了解
import java.util.base64;
import java.util.UUID;(重复)

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/352046.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号