1、
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是运行结果:
**********
*********
********
*******
******
*****
****
***
**
*
*/
public class XingHaoOne {
public static void main(String[] args) {
for(int i=10;i>0;i--){
for (int j=0; j < 10-i; j++) {
System.out.print(" ");
}
for(int o=i;o>0;o--){
System.out.print("*");
}
System.out.print("\n");
}
}
2、
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是打印结果:
*
**
***
****
*****
******
*******
********
*********
**********
*/
public class XingHaoTwo {
public static void main(String[] args) {
for(int i=10;i>0;i--){
for(int n=i;n<11;n++){
System.out.print("*");
}
System.out.print("\n");
}
}
}
3、
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是运行结果:
**********
*********
********
*******
******
*****
****
***
**
*
*/
public class XingHaoThree {
public static void main(String[] args) {
for(int i=10;i>0;i--)
{
for(int j=0;j System.out.print("*");
System.out.print("\n");
}
}
}
4、
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是打印结果:
*
**
***
****
*****
******
*******
********
*********
**********
*/
public class XingHaoFour {
public static void main(String[] args) {
for(int i=10;i>0;i--)
{
for(int j=i;j>1;j--){
System.out.print(" ");}
for(int n=i;n<11;n++){
System.out.print("*");
}
System.out.print("\n");
}
}
}
5、
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是运行结果:
***********
***********
***********
***********
***********
***********
***********
***********
***********
***********
*/
public class XingHaoJuXing {
public static void main(String[] args) {
for(int i=10;i>0;i--){
for(int n=0;n System.out.print("*");
}
for(int j=i;j<11;j++){
System.out.print("*");
}
System.out.print("\n");
}
}
}
6、
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是打印结果:
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
*/
public class Shishi {
public static void main(String[] args) {
for(int i=10;i>0;i--){
for(int f=0;f<10;f++){
System.out.print("*");}
System.out.print("\n");
}
}
}
再来个带 注释 的 :
/*
* Created on 2004-8-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author diyer6
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/*
此图是打印结果:
0**********
00*********
000********
0000*******
00000******
000000*****
0000000****
00000000***
000000000**
0000000000*
*/
public class Zaishi {
public static void main(String[] args) {
for(int i=10;i>0;i--){
for(int j=i;j<11;j++){ //j=10;j<11;循环一次,打印一个 0 ,在执行 j++ ,
//此时j=11;i<11;为false,所以在第一行只打印了一个 0 。
System.out.print("0");}
for(int n=i;n>0;n--){ /*n=10;n>0;循环一次,打印一个 * ,在执行n--,
*此时n=9;n>0;再循环一次,再打印一个 * ,在执行n--,
*此时n=8;n>0;再循环一次,再打印一个 * ,在执行n--,
*依次类推... 所就在第一行打印了10个 * 。
*接下来执行 System.out.print("\n"); 换行 。
*然后执行第一个大循环中的 i-- ; 此时 i 就等于 9 了。
*
*这时 第一个小循环 中:(j=i 从 i=9 开始循环)
*j=9;j<11;循环两次,所以在第二行只打印 2 个 0 。
*这时 第二个小循环 中:(n=i 从 i=9 开始循环)
*n=9;n>0;循环一次,打印一个 * ,在执行n--,
*此时n=8;n>0;再循环一次,再打印一个 * ,在执行n--,
*依次类推... 所就在第二行打印了 9 个 * 。
*接下来执行 System.out.print("\n"); 换行 。
*然后执行第一个大循环中的 i-- ; 此时 i 就等于 8 了。
*
*往下 依次类推....
*/
System.out.print("*");
}
System.out.print("\n");
}
}
} 0
0
相关文章
AI财税核算小程序,中小企业刚需,变现空间大!
小程序页面栈是什么?开发基础问答!
本地洗车小程序开发,汽车后市场,刚需高转化!
单店电商小程序,适合个人创业者吗?
定制开发商协会小程序的费用,包含哪些项目?
java怎么学习?java怎么入门?java在哪学?java怎么学才快?不用担心,这里为大家提供了java速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门AI工具
相关专题
本专题围绕 Archive of Our Own(AO3)官网入口展开,系统整理 AO3 最新可用官网地址、网页版访问方式、正确打开链接的方法,并详细讲解 AO3 中文界面设置、阅读语言切换及基础使用流程,帮助用户稳定访问 AO3 官网,高效完成中文阅读与作品浏览。
89
2026.02.02
本专题聚合极兔快递、京东快递、中通快递、圆通快递、韵达快递等主流物流平台的单号查询与运单追踪内容,重点解决单号查询、手机号查物流、官网入口直达、包裹进度实时追踪等高频问题,帮助用户快速获取最新物流状态,提升查件效率与使用体验。
24
2026.02.02
本专题系统讲解 Golang 在 WebAssembly(WASM)开发中的实践方法,涵盖 WASM 基础原理、Go 编译到 WASM 的流程、与 JavaScript 的交互方式、性能与体积优化,以及典型应用场景(如前端计算、跨平台模块)。帮助开发者掌握 Go 在新一代 Web 技术栈中的应用能力。
11
2026.02.02
本专题聚焦 PHP Swoole 扩展在高性能服务端开发中的应用,系统讲解协程模型、异步IO、TCP/HTTP/WebSocket服务器、进程与任务管理、常驻内存架构设计。通过实战案例,帮助开发者掌握 使用 PHP 构建高并发、低延迟服务端应用的工程化能力。
4
2026.02.02
本专题系统讲解 Java 通过 JNI 调用 C/C++ 本地代码的核心机制,涵盖 JNI 基本原理、数据类型映射、内存管理、异常处理、性能优化策略以及典型应用场景(如高性能计算、底层库封装)。通过实战示例,帮助开发者掌握 Java 与本地代码混合开发的完整流程。
5
2026.02.02
热门下载
相关下载
精品课程




