Last active
August 29, 2015 14:20
-
-
Save takanakahiko/829554cfe05f83c7ebb7 to your computer and use it in GitHub Desktop.
足し算するクラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Quiz{ | |
public Quiz(){ | |
} | |
private int seikai = 0; | |
private int huseikai = 0; | |
public void saiten(int x){ | |
if(x == 3){ | |
seikai++; | |
}else{ | |
huseikai++; | |
} | |
} | |
public int getSeikaisuu(){ | |
return seikai; | |
} | |
public int getHuseikaisuu(){ | |
return huseikai; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test{ | |
public static void main(String[] args){ | |
Quiz QuizTest = new Quiz(); | |
QuizTest.saiten(7); | |
QuizTest.saiten(8); | |
QuizTest.saiten(3); | |
QuizTest.saiten(4); | |
QuizTest.saiten(3); | |
QuizTest.saiten(3); | |
System.out.println(QuizTest.getSeikaisuu()+","+QuizTest.getHuseikaisuu()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment