public class test {
public static void main(String[] args) {
int x,y,a,b,i,j,num;
x = 100; x += 1; x--; y = 200 + x;
System.out.println("Q23=" + y--);
a = 0; x = 0;
a = 5; a += 3; x = ++a;
System.out.println("Q24=" + x);
a = 9; b = 3;
a /= b;
System.out.println("Q25=" + (a %= b));
for(i=0,j=0; i<3; i++)++j;
System.out.println("Q26=" + (i * j));
i = 2;
while(i-- > 0) System.out.println("Q27=" + i);
num = 10000;
for(i=0; i < 4; i++) num >>= i;
System.out.println("q28=" + num);
num = 0;
for(i=1; i <= 10; i++){
if(++num % i == 0) num++;
}
System.out.println("Q29=" + ++num);
/*Q30 a = 9;
if(a++ != 10 | a++ == 10) a++;
System.out.println("Q30=" + a);
System.out.println("---Q31---");
for(i = 0; i < 5; i++)
System.out.println("i==" + i);
System.out.println("Hello");
for(i = 0; i < 9; i += 3){}
System.out.println("Q32=" + i);
for(i = 0; i < 8; i++){
System.out.println("Q33=" + i);
i += 3;
}
System.out.println("---Q34---");
i = 0;
for(sayHello(); i <= 6; i += 3){
sayHello();
}
Player p1 = new Player();
Player p2 = new Player();
p1.id = 1000;
p2.id = 2000;
p1.num += p1.id;
p2.num += p2.id;
System.out.println("Q35=" + Player.num);
System.out.println("---Q36---");
Player2 p3 = new Player2();
Player2 p4 = new Player2();
p3.id = 1000;
p4.id = 2000;
p3.num += p3.id;
p4.num += p4.id;
System.out.println("p3.num==" + p3.num);
System.out.println("p4.num==" + p4.num);
Card c1 = new Card();
Card c2 = new Card();
Card c3 = c1;
c1.deposit = 1000;
c2.deposit = 2000;
c3.deposit = 3000;
int sum = c1.deposit + c2.deposit + c3.deposit;
System.out.println("Q37=" + sum);
System.out.println("---Q38---");
Card c4 = new Card(); //Cardの内容へ
Card c5 = c4;
c4.deposit = 1000;
c5.deposit = 2000;
Bank.useCard(c4);
Bank.useCard(c5);
System.out.println("c4.deposit=" + c4.deposit);
System.out.println("c5.deposit=" + c5.deposit);
}
static void sayHello(){
System.out.println("Hello");
}
}
/*Q35~Q38のクラス*/
/*Q35*/
class Player{
int id = 0;
static int num = 0;
}
/*Q36*/
class Player2{
int id = 0;
static int num = 0;
}
/*Q37とQ38*/
class Card{
int deposit;
}
/*Q38*/
class Bank{
public static void useCard(Card c ){
c.deposit -= 500;
}
}
Q23=300
Q24=9
Q25=0
Q26=9
Q27=1
Q27=0
Q28=156
Q29=12
Q30=12
---Q31---
i==0
i==1
i==2
i==3
i==4
Hello
Q32=9
Q33=0
Q33=4
---Q34---
Hello
Hello
Hello
Hello
Q35=3000
---Q36---
p3.num==3000
p4.num==3000
Q37=8000
---Q38---
c4.deposit=1000
c5.deposit=1000