質問するログイン新規登録

質問編集履歴

2

markdownの修正

2020/05/19 09:49

投稿

te623
te623

スコア4

title CHANGED
File without changes
body CHANGED
@@ -3,8 +3,8 @@
3
3
  現在javaのプログラムでLesson04_4.javaとBinary.javaの2つを使ってプログラムを作っています。
4
4
  どのようなプログラムかというと、与えられたコマンドライン引数2つの論理積と排他的論理和を計算して2進数で表示をするというものです。
5
5
 
6
-
6
+ ```java
7
- ```public class Lesson04_4 {
7
+ public class Lesson04_4 {
8
8
  public static void main(String[] args) {
9
9
  int left = Integer.parseInt(args[0]);
10
10
  int right = Integer.parseInt(args[1]);
@@ -19,9 +19,9 @@
19
19
  上記のプログラムは作成中のLesoon_04_4.javaです。
20
20
  クラスとインスタンスについての授業だったのでインスタン関数に値を直接送ろうと考えました。
21
21
 
22
+ ```java
23
+ public class Binary {
22
24
 
23
- ```public class Binary {
24
-
25
25
  public void and(int left, right){
26
26
  int n = left & right;
27
27
  String m = Integer.toBinaryString(n);

1

markdownの追加

2020/05/19 09:49

投稿

te623
te623

スコア4

title CHANGED
File without changes
body CHANGED
@@ -3,7 +3,8 @@
3
3
  現在javaのプログラムでLesson04_4.javaとBinary.javaの2つを使ってプログラムを作っています。
4
4
  どのようなプログラムかというと、与えられたコマンドライン引数2つの論理積と排他的論理和を計算して2進数で表示をするというものです。
5
5
 
6
+
6
- public class Lesson04_4 {
7
+ ```public class Lesson04_4 {
7
8
  public static void main(String[] args) {
8
9
  int left = Integer.parseInt(args[0]);
9
10
  int right = Integer.parseInt(args[1]);
@@ -13,12 +14,14 @@
13
14
    i.and(left, right);
14
15
  }
15
16
  }
17
+ ```
16
18
 
17
19
  上記のプログラムは作成中のLesoon_04_4.javaです。
18
20
  クラスとインスタンスについての授業だったのでインスタン関数に値を直接送ろうと考えました。
19
21
 
20
- public class Binary {
21
22
 
23
+ ```public class Binary {
24
+
22
25
  public void and(int left, right){
23
26
  int n = left & right;
24
27
  String m = Integer.toBinaryString(n);
@@ -31,6 +34,7 @@
31
34
  }
32
35
 
33
36
  }
37
+ ```
34
38
 
35
39
  次のプログラムは作成中のBinary.javaです。
36
40
  and()の中身は論理積を計算し、2進数になおして表示をするプログラムです。