- 1
- 0
- 约1.05万字
- 约 6页
- 2021-01-15 发布于广东
- 举报
资料
PAGE 页码页码/NUMPAGES 总页数总页数
九九乘法表
public class Test{ public static void main(String args[]){ for(int i=1;i 10;i++){ for(int j=1;j 10;j++) System.out.print(j+ * +i+ = +j*i+ \t ); System.out.println(); } }}
杨辉三角
public class Test{
public static void main(String[] args){
int[][] a=new int[10][10];
for(int i=0;i10;i++)
for(int j=0;j10;j++)
{
if (ji)
{
a[i][j]=1;
if(j==0){
a[i][j]=1;
}else{
a[i][j]=a[i-1][j-1]+a[i-1][j];
}
}else{
a[i][j]=1;
}
}
for(int i=0;i10;i++)
{
for(int k=1;k=10-i;k++)
System.out.printf( );
for(int j=0;j=i;j++){
System.out.printf(%3d ,a[i][j]);
}
System.out.printf(\n);
}
}
}
输出斐波那契数列的前20个数
public class Test{
public static void main(String[] args){
int i,a=1,b=1,c;
for(i=0;i20;i++)
{
if(i2)
{
System.out.print(1+\t);
}
else
{
c=a+b;
System.out.print(c+\t);
a=b;
b=c;
}
}
}
}
定义一个名为 Card 的扑克牌类
public class Card {
private String face;
private String suit;
public Card(String f,String s){
face=f;
suit=s;
}
protected String getFace() {
return face;
}
protected String getSuit() {
return suit;
}
public String toString(){
return face+ +suit;
}
}
设计一个表示用户的User类
public class User {
public static void main(String[] args) {
// User user = new User(littleQ,passwQ);
// System.out.println(user);
Integer a[] = new Integer[] { 0, 1, 2, 3, 4, 5 };
Integer b[] = new Integer[4];
System.arraycopy(a, 1, b, 0, b.length);
for (int i = 0; i a.length; i++)
System.out.print(a[i]+ );
System.out.println();
for (int i = 0; i b.length; i++)
System.out.print(b[i]+ );
}
private String name;
private String password;
private static int sumOfUsers = 0;
public User() {
this(null, null);
}
public User(String name) {
this(name, null);
}
public User(String name, String password) {
this.name = name;
您可能关注的文档
最近下载
- 浙江省公路工程设计标准化 组合钢桁梁桥通用图 第四册 100m长18m宽.pdf VIP
- 2025年下半年中小学教师资格证考试综合素质(中学)真题.pdf VIP
- CRRC版〈S-S法〉语言发育迟缓检查评估手册.docx
- 计算方法教案.doc
- 电路与模拟电子技术(第2版)高玉良-第3章 正弦交流电路.ppt VIP
- 电路与模拟电子技术(第2版)高玉良-第4章 非正弦周期电流电路.ppt VIP
- 2024年杭州市急救中心招聘真题.pdf VIP
- 山东协和学院本科毕业论文模板(1).docx VIP
- 《AutoCAD 2021基础与应用案例教程》全套教学课件.pptx
- GB_T 43917.1-2024焊接烟尘捕集和分离设备 第 1 部分一般要求.docx VIP
原创力文档

文档评论(0)