質問編集履歴
2
コードを打ち込みました
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,10 +6,98 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
状況は下の画像通りです。
|
10
|
-
|
11
9
|
実行するとHello World と表示されます。
|
12
10
|
|
13
|
-
|
11
|
+
状況は下の通りです。
|
14
12
|
|
13
|
+
|
14
|
+
|
15
|
+
<Main Activity.java>
|
16
|
+
|
17
|
+
```package com.example.myapplication2;
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
import android.support.v7.app.AppCompatActivity;
|
22
|
+
|
23
|
+
import android.os.Bundle;
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
public class MainActivity extends AppCompatActivity {
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
public static void main(String[] args){
|
32
|
+
|
33
|
+
int A;
|
34
|
+
|
35
|
+
A = 00;
|
36
|
+
|
37
|
+
if (A == 00) {
|
38
|
+
|
39
|
+
System.out.println("総記");
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
else if (A == 01) {
|
44
|
+
|
45
|
+
System.out.println("百科事典");
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
if (A == 02) {
|
50
|
+
|
51
|
+
System.out.println("年鑑・雑誌");
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
else if (A == 04) {
|
56
|
+
|
57
|
+
System.out.println("情報科学");
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
<activity_main.xml>
|
68
|
+
|
69
|
+
```<?xml version="1.0" encoding="utf-8"?>
|
70
|
+
|
71
|
+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
72
|
+
|
73
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
74
|
+
|
75
|
+
xmlns:tools="http://schemas.android.com/tools"
|
76
|
+
|
77
|
+
android:layout_width="match_parent"
|
78
|
+
|
79
|
+
android:layout_height="match_parent"
|
80
|
+
|
81
|
+
tools:context=".MainActivity">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<TextView
|
86
|
+
|
15
|
-
|
87
|
+
android:layout_width="wrap_content"
|
88
|
+
|
89
|
+
android:layout_height="wrap_content"
|
90
|
+
|
91
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
92
|
+
|
93
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
94
|
+
|
95
|
+
app:layout_constraintRight_toRightOf="parent"
|
96
|
+
|
97
|
+
app:layout_constraintTop_toTopOf="parent" />
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
</android.support.constraint.ConstraintLayout>
|
102
|
+
|
103
|
+
```
|
1
ソースコードと実行した状態を追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -3,3 +3,13 @@
|
|
3
3
|
if文のプログラムを動かしたいのですが,調べても分からなかったので質問します。
|
4
4
|
|
5
5
|
条件式は書けているですが,動きません。初歩的なことで申し訳ないのですが,教えてください。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
状況は下の画像通りです。
|
10
|
+
|
11
|
+
実行するとHello World と表示されます。
|
12
|
+
|
13
|
+
![イメージ説明](d36f8d8e25a54dbe85815e17fcb283e8.png)
|
14
|
+
|
15
|
+
![イメージ説明](1a5fb5b5137228c60321fa8f0a363cfa.png)
|