java学习源代码 java入门源代码( 二 )


g2.drawString("LEVEL", 194, 10);
g2.drawString(""+LEVEL, 210, 28);
g2.drawString("NEXT", 196, 45);
g2.drawString("SCORE",193, 110);
g2.drawString(""+SCORE,205, 130);
g2.drawString("Xiong", 205, 160);
g2.drawString("Xuan", 205, 180);
}
//方块下落的方法
public void down()
{
Y++;
switch(MODE)
{
case 0: o[X+2][Y]=1;
o[X+2][Y+1]=1;
o[X+2][Y+2]=1;
o[X+2][Y+3]++;
o[X+2][Y-1]=0;
break;
case 1: o[X][Y+1]++;
o[X+1][Y+1]++;
o[X+2][Y+1]++;
o[X+3][Y+1]++;
o[X][Y]=0;
o[X+1][Y]=0;
o[X+2][Y]=0;
o[X+3][Y]=0;
break;
case 2: o[X+2][Y]=1;
o[X+2][Y+1]=1;
o[X+2][Y+2]++;
o[X+1][Y+2]++;
o[X+2][Y-1]=0;
o[X+1][Y+1]=0;
break;
case 3: o[X][Y]=1;
o[X][Y+1]++;
o[X+1][Y+1]++;
o[X+2][Y+1]++;
o[X][Y-1]=0;
//o[X][Y]=0;
o[X+1][Y]=0;
o[X+2][Y]=0;
break;
case 4: o[X+1][Y]=1;
o[X+2][Y]++;
o[X+1][Y+1]=1;
o[X+1][Y+2]++;
o[X+1][Y-1]=0;
o[X+2][Y-1]=0;
break;
case 5: o[X][Y]++;
o[X+1][Y]++;
o[X+2][Y]=1;
o[X+2][Y+1]++;
o[X][Y-1]=0;
o[X+1][Y-1]=0;
o[X+2][Y-1]=0;
break;
case 6: o[X+1][Y]=1;
o[X+1][Y+1]=1;
o[X+1][Y+2]++;
o[X+2][Y+2]++;
o[X+1][Y-1]=0;
//o[X+1][Y]=0;
//o[X+1][Y+1]=0;
o[X+2][Y+1]=0;
break;
case 7: o[X][Y+1]++;
o[X+1][Y+1]++;
o[X+2][Y+1]++;
o[X+2][Y]=1;
o[X][Y]=0;
o[X+1][Y]=0;
//o[X+2][Y]=0;
o[X+2][Y-1]=0;
break;
case 8: o[X+1][Y]++;
o[X+2][Y]=1;
o[X+2][Y+1]=1;
o[X+2][Y+2]++;
o[X+1][Y-1]=0;
o[X+2][Y-1]=0;
//o[X+2][Y]=0;
//o[X+2][Y+1]=0;
break;
case 9: o[X+1][Y]=1;
o[X+2][Y]++;
o[X+3][Y]++;
o[X+1][Y+1]++;
o[X+1][Y-1]=0;
o[X+2][Y-1]=0;
o[X+3][Y-1]=0;
//o[X+1][Y]=0;
break;
case 10:o[X+1][Y]=1;
o[X+1][Y+1]++;
o[X+2][Y+1]=1;
o[X+2][Y+2]++;
o[X+1][Y-1]=0;
//o[X+1][Y]=0;
o[X+2][Y]=0;
//o[X+2][Y+1]=0;
break;
case 11:o[X+2][Y]=1;
o[X+3][Y]++;
o[X+1][Y+1]++;
o[X+2][Y+1]++;
o[X+2][Y-1]=0;
o[X+3][Y-1]=0;
o[X+1][Y]=0;
//o[X+2][Y]=0;
break;
case 12:o[X+1][Y+1]=1;
o[X+2][Y+1]++;
o[X+1][Y+2]++;
o[X+2][Y]=1;
o[X+1][Y]=0;
//o[X+2][Y]=0;
//o[X+1][Y+1]=0;
o[X+2][Y-1]=0;
break;
case 13:o[X+1][Y]++;
o[X+2][Y]=1;
o[X+2][Y+1]++;
o[X+3][Y+1]++;
o[X+1][Y-1]=0;
o[X+2][Y-1]=0;
//o[X+2][Y]=0;
o[X+3][Y]=0;
break;
case 14:o[X+1][Y]=1;
o[X+2][Y]=1;
o[X+1][Y+1]++;
o[X+2][Y+1]++;
o[X+1][Y-1]=0;
o[X+2][Y-1]=0;
//o[X+1][Y]=0;
//o[X+2][Y]=0;
break;
}
//如果碰撞,则自动上升一格
for(int i=0;i13;i++)
{
for(int j=0;j21;j++)
{
if (o[i][j]==2) up();
}
}
}
java新手,求完整的源代码//都是从新手过来的java学习源代码,以下代码供参考
//1.
public class BankAccount {
private static String acctnum;
private static double money;
private static void showAcct() {
System.out.println("账号为: " + acctnum);
}
private static void showMoney() {
System.out.println("余额为: " + money);
}
public BankAccount(String acc, double m) {
this.acctnum = acc;
this.money = m;
}
public static void main(String[] args) {
BankAccount ba = new BankAccount("626600018888", 5000.00);
ba.showAcct();

推荐阅读