怎样用JAVA编写图形
*
* *
* *
* *
* * * * *和
*
* *
* *
* *
* 谢谢了!
*
* *
* *
* *
* * * * *和
*
* *
* *
* *
* 谢谢了!
解决方案 »
- 关于Java Sound
- (int)x与Integer.parseInt(x)的区别
- 看JavaCore书,有一个问题
- 请教一个SWING中JOPTIONPANE和JDIALOG的问题
- 如何获取bean的get方法
- 求检查一个时间段时是否包含星期六日的方法
- Boolean.getBoolean方法如何返回True
- ***SCJP***
- 那位高手指点一下对存储过程的调用方法
- Exception in thread "main" java.lang.NoClassDefFoundError:文件名,这是什么意思?
- java可以做模式识别吗?为什么好像国内没人用java搞模式识别啊?
- java笔试题:
System.out.println("*");
System.out.println("* *");
System.out.println("* *");
System.out.println("* *");
System.out.println("* * * * *");
是这样Java code *
* *
* *
* *
* * * * *
[/Quote]
public class T { public static void main(String[] args) { for(int i=0; i<5; i++){
for(int j=0; j<10; j++){
if((j==4+i || j==4-i) && (i != 4)){
System.out.print("*");
}
if(i ==4){
System.out.print("*");
}
else{
System.out.print(" ");
}
}
System.out.println();
}
}}运行结果:
*
* *
* *
* *
**********
public class T { public static void main(String[] args) { for(int i=0; i<5; i++){
for(int j=0; j<10; j++){
if((j==3+i || j==4-i) && (i != 4 && i!=0) ){
System.out.print("*");
}
if(i == 0 && j==4){
System.out.print("*");
}
if(i ==4 && j%2==0){
System.out.print("*");
}
else{
System.out.print(" ");
}
}
System.out.println();
}
}}
运行结果:
*
* *
* *
* *
* * * * * 好麻烦的吖,我是凑答案的,希望能改进下!
public class T { public static void main(String[] args) { for(int i=0; i<5; i++){
for(int j=0; j<10; j++){
if((j==4+i || j==4-i) && (i != 4 && i!=0) ){
System.out.print("*");
}
else if(i == 0 && j==4){
System.out.print("*");
}
else if(i ==4 && j%2==0){
System.out.print("*");
}
else{
System.out.print(" ");
}
}
System.out.println();
}
}}嗯。这样好看多了!
public class T { public static void main(String[] args) {
for(int i=1; i<=5; i++){
for(int j=1; j<=3; j++){
if(i%j == 0){
System.out.print("*");
}
else{
System.out.print(" ");
}
}
System.out.println();
}
}
}
*
**
* *
**
*