013 クラスライブラリ 013 クラスライブラリ(文字列を扱うクラス) 004解答例 文字列の比較: public class StringComparison { public static void main(String[] args) { // 2つの文字列 String str1 = "Hello"; String... 2023.11.26 013 クラスライブラリ解答例
013 クラスライブラリ 013 クラスライブラリ(文字列を扱うクラス) 003解答例 特定の部分文字列の検索: public class SubstringSearch { public static void main(String[] args) { // 入力として与えられた文字列 String input = "He... 2023.11.26 013 クラスライブラリ解答例
013 クラスライブラリ 013 クラスライブラリ(文字列を扱うクラス) 002解答例 文字列の結合: public class StringConcatenation { public static void main(String[] args) { // 2つの文字列 String str1 = "Hello"; Str... 2023.11.26 013 クラスライブラリ解答例
013 クラスライブラリ 013 クラスライブラリ(文字列を扱うクラス) 001 解答例 public class ReverseString { public static void main(String[] args) { // 入力として与えられた文字列 String input = "Hello"; // 逆順にするた... 2023.11.26 013 クラスライブラリ解答例
012 staticメンバ 012 staticメンバ(staticメソッド) 005 解答例 public class InstanceCounter { // static変数 - 生成されたインスタンスの数を保持 private static int instanceCount = 0; // インスタンス変数 - 各インスタン... 2023.11.26 012 staticメンバ解答例
012 staticメンバ 012 staticメンバ(staticメソッド) 004 解答例 public class StringUtils { // staticメソッド - 与えられた文字列が回文かどうかを判定するメソッド public static boolean isPalindrome(String str) { // ... 2023.11.26 012 staticメンバ解答例
012 staticメンバ 012 staticメンバ(staticメソッド) 003 解答例 public class MathUtils { // staticメソッド - 与えられた数が素数かどうかを判定するメソッド public static boolean isPrime(int number) { if (number <... 2023.11.26 012 staticメンバ解答例
012 staticメンバ 012 staticメンバ(static変数) 002 解答例 public class Countdown { // static変数 - カウントダウンの初期値を表す変数 private static int initialValue; // インスタンス変数 - カウントダウンの現在の値を表す変数... 2023.11.26 012 staticメンバ解答例
012 staticメンバ 012 staticメンバ(static変数) 001 解答例 public class SimpleCounter { // static変数 - カウントされた回数を表す変数 private static int totalCount = 0; // インスタンス変数 - インスタンスごとのカウント... 2023.11.26 012 staticメンバ解答例
011 コンストラクタ 011 コンストラクタ(別のコンストラクタを呼び出す) 009 解答例 public class Circle { private double radius; // デフォルトコンストラクタ public Circle() { // 別のコンストラクタを呼び出す this(1.0); } // 引数つきコンス... 2023.11.25 011 コンストラクタ解答例