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 static void main(String[] args) { | |
| int num1 = 2; | |
| int num2 = 5; | |
| // ①~④のどれかをここに挿入します | |
| System.out.println(func.apply(num1,num2)); | |
| } |
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
| package sample; | |
| import java.math.BigDecimal; | |
| public class Bdcaution { | |
| public static void main(String[] args) { | |
| BigDecimal decimal1 = BigDecimal.valueOf(1.0); | |
| BigDecimal decimal2 = BigDecimal.valueOf(2.0); |
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
| package sample; | |
| import java.math.BigDecimal; | |
| public class Bdcaution { | |
| public static void main(String[] args) { | |
| BigDecimal decimal1 = BigDecimal.valueOf(1.0); | |
| BigDecimal decimal2 = BigDecimal.valueOf(2.0); |
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 Bdcaution { | |
| public static void main(String[] args) { | |
| BigDecimal decimal1 = new BigDecimal(1.0); | |
| BigDecimal decimal2 = new BigDecimal(2.0); | |
| // aとbを足す | |
| decimal1.add(decimal2); | |
| // aを出力 | |
| System.out.println(decimal1); |
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
| package sample; | |
| public class SampleExecute { | |
| // HoneyGirlクラスを生成しprintOut()を実行 | |
| public static void main(String[] args) { | |
| HoneyGirl girl = new HoneyGirl(); | |
| girl.printOut("Hey!Boy and Girls!!"); | |
| } | |
| } |
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
| package sample; | |
| public class HoneyBoy { | |
| public void printOut(String strArg){ | |
| // 引数strArgを大文字で出力 | |
| System.out.println(strArg.toUpperCase()); | |
| } | |
| } | |
| package sample; |
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
| package sample; | |
| public class SampleForText { | |
| public static void main(String[] args) { | |
| // for文の中で型の異なる式を定義する場合はあらかじめ型宣言を行う。 | |
| int i = 0; | |
| long j = 0; | |
| for(i=0,j=0;i<3;i++,j++){ |
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
| package sample; | |
| public class SampleForText { | |
| public static void main(String[] args) { | |
| // 魚の名前と球技の名前を配列で定義する。 | |
| String[] fish = {"mebaru","iwasi","aji","kasago"}; | |
| String[] sports = {"soccer","baseball","basketball","tennis"}; | |
| // 拡張for文で二つを一気に出力 | |
| for(String fishOut,sportsOut: fish,sports){ |