クエスチョン1 小澤

This commit is contained in:
2026-09-09 11:28:28 +09:00
parent 1b863df929
commit 0c6a625b6b
12 changed files with 92 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ public class PTra01_01 {
public static void main(String[] args) {
//TODO Hello,world と出力してください
System.out.println("Hello,world");
}
}

View File

@@ -8,12 +8,12 @@ public class PTra01_02 {
public static void main(String[] args) {
// TODO 11行目のコメントを単一行コメントにしてコンパイルエラーが出ないようにしてください
ここをコメントアウトする
//ここをコメントアウトする
// TODO 14行目 ~ 16行目を複数行コメントにしてコンパイルエラーが出ないようにしてください
/*ここをコメントアウトする
ここをコメントアウトする
ここをコメントアウトする
ここをコメントアウトする
ここをコメントアウトする*/
}
}

View File

@@ -8,10 +8,13 @@ public class PTra01_03 {
public static void main(String[] args) {
// TODO 文字列型の変数 str を宣言してください。
String str;
// TODO str に こんにちは を代入してください
str = "こんにちは";
// TODO str の値を出力してください
System.out.println(str);
}
}

View File

@@ -8,8 +8,10 @@ public class PTra01_04 {
public static void main(String[] args) {
// TODO 数値型の変数 number を 10 で初期化してください。
int number = 10;
// TODO number の値を出力してください
System.out.println(number);
}
}

View File

@@ -8,8 +8,10 @@ public class PTra01_05 {
public static void main(String[] args) {
// TODO char型の変数 ch を A で初期化してください。
char ch = 'A';
// TODO ch の値を出力してください
System.out.println(ch);
}
}

View File

@@ -8,8 +8,10 @@ public class PTra01_06 {
public static void main(String[] args) {
// TODO boolean型の変数 bo を true で初期化してください。
boolean bo = true;
// TODO bo の値を出力してください
System.out.println(bo);
}
}

View File

@@ -8,8 +8,10 @@ public class PTra01_07 {
public static void main(String[] args) {
// TODO long型の変数 lo を 1000000000000 で初期化してください。
long lo = 1000000000000L;
// TODO lo の値を出力してください
System.out.println(lo);
}
}

View File

@@ -8,8 +8,10 @@ public class PTra01_08 {
public static void main(String[] args) {
// TODO float型の変数 fl を 3.14 で初期化してください。
float fl = 3.14F;
// TODO fl の値を出力してください
System.out.println(fl);
}
}

View File

@@ -8,10 +8,38 @@ public class PTra01_09 {
public static void main(String[] args) {
// TODO 基本型8種類の変数を宣言します(変数名は自分できめてOKです)
byte bNum;
short sNum;
int iNum;
long lNum;
float fMin;
double dMin;
char ch1;
boolean boo;
// TODO 宣言した変数に、値を代入してください(代入する値はなんでもOKです)
bNum = 127;
sNum = 30000;
iNum = 10000;
lNum = 50000L;
fMin = 0.01F;
dMin = 0.001;
ch1 = 'N';
boo = true;
// TODO それぞれの変数の中身を出力してください
System.out.println(bNum);
System.out.println(sNum);
System.out.println(iNum);
System.out.println(lNum);
System.out.println(fMin);
System.out.println(dMin);
System.out.println(ch1);
System.out.println(boo);
}
}