This file contains 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
<?php | |
$numbers = range(0, 9); | |
// 0を除いた偶数だけ欲しい | |
$evenNumbers = array_filter( | |
// https://www.php.net/manual/ja/function.array-filter.php | |
// 上記の例2を参照 | |
array_filter($numbers), | |
fn($n) => $n % 2 === 0 | |
); |
This file contains 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
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Random; | |
public class Main { | |
/** | |
* あるお店にかけられた問い合わせ電話の応対をシミュレートするコード | |
* | |
* 客からの電話にまず店員が出て質問内容を聞いて答える。 | |
* もし自分では答えられない内容だったら店長に取り次ぐ。 |
This file contains 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
import java.util.Random; | |
public class Main{ | |
/** | |
* あるお店にかけられた問い合わせ電話の応対をシミュレートするコード | |
* | |
* 客からの電話にまず店員が出て質問内容を聞いて答える。 | |
* もし自分では答えられない内容だったら店長に取り次ぐ。 | |
* | |
* しかし、店長が忙しくて電話に出られない時は、 |
This file contains 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
class Main { | |
public static void main(String[] args) { | |
final FighterPhysicalAttack fighterPhysicalAttack = new FighterPhysicalAttack(50); | |
System.out.println(fighterPhysicalAttack.singleAttackDamage()); | |
System.out.println(fighterPhysicalAttack.doubleAttackDamage()); | |
} | |
} | |
class PhysicalAttack { |
This file contains 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
class Main { | |
public static void main(String[] args) { | |
final FighterPhysicalAttack fighterPhysicalAttack = new FighterPhysicalAttack(50); | |
System.out.println(fighterPhysicalAttack.singleAttackDamage()); | |
System.out.println(fighterPhysicalAttack.doubleAttackDamage()); | |
} | |
} | |
class PhysicalAttack { |
This file contains 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
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.HashSet; | |
import java.util.Set; | |
class Main { | |
public static void main(String[] args) { | |
final Customer customerA = new Customer("ID-0001"); | |
final Customer customerB = new Customer("ID-0002"); | |
final Customer customerC = new Customer("ID-0003"); |
This file contains 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
import java.util.HashMap; | |
import java.util.Map; | |
class Main { | |
static final Map<MagicType, Magic> magics = new HashMap<>(); | |
public static void main(String[] args) { | |
final Caster caster = new Caster("アルトリア", 90); | |
final Fire fire = new Fire(caster); | |
final Thunder thunder = new Thunder(caster); | |
final HellFire hellFire = new HellFire(caster); |
This file contains 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
<html> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | |
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> | |
<style> | |
td{ |
This file contains 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
<html> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | |
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> | |
<style> | |
td{ |
This file contains 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
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.Random; | |
public class CallingMethod{ | |
public static void main(String[] args){ | |
//電話、メンバー、スタッフのインスタンスを作る | |
Telephone phone = new Telephone(); | |
Member urabe = new Member("卜部"); | |
Staff otsuka = new Staff("大塚"); |
NewerOlder