本文へスキップ
製品デスクトップツールTASTECAD図面の確認TASTEFILESファイル管理TASTEFTPファイル転送TASTESSHリモートワークスペースTASTEZIP圧縮と展開TASTEWINMファイル管理開発ツールTASTECODERust 統合開発環境TASTESTUDIO統合開発・テスト環境TASTEETLデータ統合(ETL)サーバーTASTEREMOTEリモートデスクトップサーバーTASTEGEO空間情報サーバーTASTEMAILメールワークスペース投資TASTESTOCK株式自動売買デスクトップアプリはじめるダウンロードドキュメント購入すべての製品
マーケットプレイス
ニュース
技術ニュース今日の開発ニュース開発ドキュメントプログラミング言語RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWebフロントエンド フレームワークNext.jsReactVue.js · NuxtSvelteKitAngularサーバー フレームワークSpring BootDjangoFastAPIASP.NET CoreNestJS · Expressアプリ・デスクトップ フレームワークTauriFlutterReact NativeElectronアルゴリズムアルゴリズムの基礎主要アルゴリズム発展アルゴリズム実務のアルゴリズム
コミュニティプロジェクト開発ログプロンプトAIツールの問題ショーケースコミュニティガイド
協業技術移転ウェブサイト構築デスクトップアプリ構築リリース・決済パイプライン販売パートナーお問い合わせ
サービスリモートデスクトップインストールパッケージのカスタマイズ
TASTEDEV
製品

デスクトップツール

TASTECAD複雑な図面を、軽やかにひらくTASTEFILES必要なファイルだけを、最速でTASTEFTPファイルが行き交う、いちばん端正な道TASTESSHサーバーとあなたを、より確かにつなぐTASTEZIPより速くまとめ、より安全にひらくTASTEWINM2つの画面で整理する、キーボード中心のファイルマネージャー

開発ツール

TASTECODERust アプリの編集・ビルド・デバッグ・テストまでひとつのウィンドウでTASTESTUDIO編集からリモートテスト、承認した AI 修正までTASTEETL値を見ながら、データを運ぶ

サーバー

TASTEREMOTE自社サーバーで運用するリモートデスクトップTASTEGEOGeoServer 互換の空間情報サーバーを Rust で作り直しますTASTEMAILメールの主導権を、もう一度自分の手に

投資

TASTESTOCKいつ・何を。自分で決めたルールどおりに動く株式自動売買

はじめる

ダウンロード全製品の最新版ドキュメント各製品の使い方購入サブスクリプション・永久ライセンスすべての製品全製品を一覧で
すべての製品
マーケットプレイスニュース
技術

ニュース

今日の開発ニュース言語・フレームワーク・GitHub・AI の公式発表開発ドキュメント言語・フレームワーク・アルゴリズムのガイド

プログラミング言語

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

フレームワーク

Webフロントエンド フレームワークNext.jsReactVue.js · NuxtSvelteKitAngular
サーバー フレームワークSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
アプリ・デスクトップ フレームワークTauriFlutterReact NativeElectron

アルゴリズム

アルゴリズムの基礎計算量解析 · ソート · 探索 · 基本データ構造 · 木構造とヒープ主要アルゴリズムグラフ探索 · 最短経路と最小全域木 · 動的計画法 · 貪欲法 · 分割統治法 · バックトラッキング発展アルゴリズム文字列アルゴリズム · 数学と整数論 · ビット演算 · セグメント木 · Union-Find実務のアルゴリズムコーディング面接対策 · LRUキャッシュ · レート制限 · コンシステントハッシュ法
開発ドキュメントをすべて見る
コミュニティ
プロジェクトビルダーと作品を探す開発ログ決定と試行錯誤プロンプト再利用できる指示AIツールの問題Claude・Codex・Gemini の問題と回避策ショーケース完成した成果コミュニティガイドオープンにつくる方法
協業
技術移転Rust・egui でネイティブアプリを作るウェブサイト構築10言語、アカウント、ドキュメントとダウンロードデスクトップアプリ構築Rust・egui、WebView なしリリース・決済パイプライン署名・MSI・deb・rpm・AppImage・ハッシュ販売パートナー紹介して決済額の30%お問い合わせ構築・提携・投資のご相談
サービス
リモートデスクトップブラウザから自分のパソコンへインストールパッケージのカスタマイズ必要な機能だけ、設定は事前に
購入
JA
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
ログイン
ログイン
TASTEDEV

小さなツールから、より良い開発へ。

support@tastedev.netTASTEDEVを支援
製品製品ラインナップ購入ドキュメントダウンロードマーケットプレイスサポート
コミュニティプロジェクト開発ログプロンプトAIツールの問題ショーケース
ポリシー会社概要プライバシーポリシー利用規約サブスクリプション規約返金ポリシーコミュニティガイドライン
アカウントログイン新規登録
訪問者
今日
昨日
累計閲覧
商号
GXSOFT
代表者
CHOI YOUNG GU
事業者登録番号
853-44-00368
所在地
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
電話
+82-10-4404-1523
メール
whitecalvin@tastedev.net
個人情報保護責任者
CHOI YOUNG GU

© 2026 TASTEDEV製品情報は検証済みの開発ソースに基づいています。リリース・改善中

Java ドキュメント
Java
Getting StartedSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts
ディスカッション

Java ガイド · 3/6

Types and Data

この章は現在、英語でのみ提供しています。

Every Java value is either a primitive or a reference to an object. This chapter covers that split, arrays, your own types (classes, interfaces, records, enums), generics, and the everyday collections List, Map, and Set.

Primitives versus objects

Primitives hold their value directly and can never be null. Everything else is an object, and a variable of an object type holds a reference to it.

PrimitiveSizeWrapper class
byte, short, int, long8, 16, 32, 64-bit integersByte, Short, Integer, Long
float, double32, 64-bit floating pointFloat, Double
charone 16-bit UTF-16 code unitCharacter
booleantrue or falseBoolean

Collections store only objects, so an int is wrapped in an Integer automatically (autoboxing). Watch for two pitfalls: == on wrappers compares references, so use equals, and unboxing a null throws NullPointerException.

int a = 1_000; // underscores for readability
long big = 9_000_000_000L; // long literals need an L
double pi = 3.14159;

Integer x = 1000; // autoboxing
Integer y = 1000;
System.out.println(x.equals(y)); // true
System.out.println(x == y); // reference comparison, may be false

int parsed = Integer.parseInt("42");
String text = String.valueOf(parsed);

Arrays

An array is a fixed-length sequence of one type. Its size is in the length field, indexes start at zero, and going out of bounds throws ArrayIndexOutOfBoundsException. java.util.Arrays has helpers for sorting and printing.

int[] scores = {90, 75, 88};
String[] names = new String[3]; // every slot starts as null
names[0] = "Duke";

java.util.Arrays.sort(scores);
System.out.println(java.util.Arrays.toString(scores)); // [75, 88, 90]

int[][] grid = new int[2][3]; // 2 rows, 3 columns
grid[1][2] = 7;

For data that grows or shrinks, use a collection such as ArrayList.

Classes, interfaces, records, and enums

An interface is a contract of methods to implement, optionally with shared methods. A class can implement many interfaces but extend only one class.

この章について質問がありますか?
前の章Syntax Basics次の章Modules and Packages
default

Records declare immutable data carriers concisely; the compiler generates the constructor, accessors, equals, hashCode, and toString. Accessors are named after the components: radius(), not getRadius().

interface Shape {
    double area();
    default String describe() {
        return getClass().getSimpleName() + " area=" + area();
    }
}

record Circle(double radius) implements Shape {
    Circle { // compact constructor for validation
        if (radius < 0) throw new IllegalArgumentException("radius < 0");
    }
    public double area() { return Math.PI * radius * radius; }
}

record Rect(double width, double height) implements Shape {
    public double area() { return width * height; }
}

enum Status {
    ACTIVE("active"), SUSPENDED("suspended");
    private final String label;
    Status(String label) { this.label = label; }
    String label() { return label; }
}

An enum turns a fixed set of constants into a real type. It can carry fields and methods, works naturally with switch, and provides valueOf and values() for free.

Generics basics

Generics parameterize code by type, so one implementation serves many types while the compiler checks everything up front instead of leaving casts for runtime. Type arguments must be reference types, which is why you write List<Integer> rather than List<int>.

record Pair<A, B>(A first, B second) {}

static <T extends Comparable<T>> T max(java.util.List<T> items) {
    T best = items.get(0);
    for (T item : items) {
        if (item.compareTo(best) > 0) best = item;
    }
    return best;
}

var pair = new Pair<>("age", 30); // diamond operator infers the types
String key = pair.first();
int biggest = max(java.util.List.of(3, 9, 4)); // 9

A bound such as T extends Comparable<T> lets you call that type's methods inside the generic code. For parameters you only read from, wildcards like List<? extends Number> make an API accept more argument types.

Collections: List, Set, and Map

The collections framework in java.util separates interfaces from implementations. The convention is to declare variables with the interface type and pick the implementation that suits the job.

InterfaceCommon implementationsBehavior
ListArrayList, LinkedListOrdered, duplicates allowed
SetHashSet, LinkedHashSet, TreeSetNo duplicates
MapHashMap, LinkedHashMap, TreeMapKey-value pairs
import java.util.*;

List<String> langs = new ArrayList<>(List.of("Java", "Go"));
langs.add("Rust");
langs.remove("Go");

Set<String> tags = new HashSet<>();
tags.add("jvm");
tags.add("jvm"); // duplicate is ignored
System.out.println(tags.size()); // 1

Map<String, Integer> stock = new HashMap<>();
stock.put("apple", 3);
stock.merge("apple", 2, Integer::sum); // 5
int pears = stock.getOrDefault("pear", 0);
for (Map.Entry<String, Integer> e : stock.entrySet()) {
    System.out.println(e.getKey() + "=" + e.getValue());
}

List<Integer> fixed = List.of(1, 2, 3); // unmodifiable

Collections from List.of, Set.of, and Map.of are unmodifiable, and add throws UnsupportedOperationException; copy them into a mutable collection, as in the first line, when you need changes. HashMap and HashSet promise no order: use LinkedHashMap for insertion order or TreeMap for sorted keys.

Summary

  • Primitives store values; object variables store references. Compare objects with equals.
  • Arrays have a fixed length; use collections for data that grows or shrinks.
  • Records model immutable data, enums model fixed sets of constants, and interfaces define contracts.
  • Generics give type-safe reuse, and List, Set, and Map cover most everyday data structures.

コメント 0件

人気のコメント順新しい順

ログイン · ログインするとコメントできます。