Vai al contenuto principale
ProdottiStrumenti desktopTASTECADVisualizzazione disegniTASTEFILESGestione fileTASTEFTPTrasferimento fileTASTESSHSpazio di lavoro remotoTASTEZIPCompressione ed estrazioneTASTEWINMGestione fileStrumenti per sviluppatoriTASTECODEAmbiente di sviluppo integrato per RustTASTESTUDIOAmbiente integrato di sviluppo e testTASTEETLIntegrazione dati (ETL)ServerTASTEREMOTEServer di desktop remotoTASTEGEOServer geospazialeTASTEMAILSpazio di lavoro emailInvestimentiTASTESTOCKApp desktop di trading automatico azionarioIniziaDownloadDocumentazioneAcquistaTutti i prodotti
Marketplace
Notizie
TecnologiaNotizieNotizie di sviluppo di oggiDocumentazioneLinguaggi di programmazioneRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFramework frontend webNext.jsReactVue.js · NuxtSvelteKitAngularFramework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFramework per app e desktopTauriFlutterReact NativeElectronAlgoritmiBasi degli algoritmiAlgoritmi fondamentaliAlgoritmi avanzatiAlgoritmi pratici
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrinaGuida alla community
CollaboraTrasferimento tecnicoRealizzazione del sito webRealizzazione di app desktopPipeline di rilascio e pagamentoPartner commercialeContatti
ServiziDesktop remotoPacchetti di installazione su misura
TASTEDEV
Prodotti

Strumenti desktop

TASTECADApri con leggerezza anche i disegni più complessiTASTEFILESSolo i file che servono, alla massima velocitàTASTEFTPLa via più ordinata per i tuoi fileTASTESSHUn legame più solido tra te e i tuoi serverTASTEZIPComprimi più veloce, estrai più sicuroTASTEWINMUn file manager a due pannelli pensato per la tastiera

Strumenti per sviluppatori

TASTECODEModifica, compila, esegui il debug e testa app Rust in un'unica finestraTASTESTUDIODalla modifica ai test remoti e alle correzioni IA approvateTASTEETLSposta i dati guardando i valori

Server

TASTEREMOTEUn desktop remoto che gira sul tuo serverTASTEGEOUn server geospaziale compatibile con GeoServer, ricostruito in RustTASTEMAILRiprendi il controllo della tua posta

Investimenti

TASTESTOCKTrading automatico azionario secondo le regole che decidi tu: quando e che cosa

Inizia

DownloadUltime versioni di ogni prodottoDocsCome usare ogni prodottoAcquistaAbbonamenti e licenze perpetueTutti i prodottiTutti i prodotti a colpo d’occhio
Tutti i prodotti
MarketplaceNotizie
Tecnologia

Notizie

Notizie di sviluppo di oggiAnnunci ufficiali su linguaggi, framework, GitHub e IADocumentazioneGuide a linguaggi, framework e algoritmi

Linguaggi di programmazione

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Framework

Framework frontend webNext.jsReactVue.js · NuxtSvelteKitAngular
Framework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Framework per app e desktopTauriFlutterReact NativeElectron

Algoritmi

Basi degli algoritmiAnalisi della complessità · Ordinamento · Ricerca · Strutture dati di base · Alberi e heapAlgoritmi fondamentaliVisita dei grafi · Cammini minimi e alberi ricoprenti · Programmazione dinamica · Algoritmi greedy · Divide et impera · BacktrackingAlgoritmi avanzatiAlgoritmi sulle stringhe · Matematica e teoria dei numeri · Manipolazione dei bit · Alberi di segmenti · Union-FindAlgoritmi praticiStrategia per colloqui di programmazione · Cache LRU · Rate limiting · Hashing consistente
Tutta la documentazione di sviluppo
Community
ProgettiScopri sviluppatori e lavoriLog di sviluppoDecisioni e lezioni appresePromptIstruzioni riutilizzabiliProblemi degli strumenti di IAProblemi e alternative di Claude, Codex, GeminiVetrinaRisultati completatiGuida alla communityCome sviluppiamo in modo aperto
Collabora
Trasferimento tecnicoApp native in Rust ed eguiRealizzazione del sito web10 lingue, account, documentazione e downloadRealizzazione di app desktopRust ed egui, senza WebViewPipeline di rilascio e pagamentoFirma, MSI, deb, rpm, AppImage, hashPartner commercialeConsigliaci e ricevi il 30%ContattiSviluppo, partnership e investimenti
Servizi
Desktop remotoRaggiungi il tuo computer dal browserPacchetti di installazione su misuraSolo il necessario, impostazioni precaricate
Acquista
IT
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Accedi
Accedi
TASTEDEV

Dai piccoli strumenti a uno sviluppo migliore.

support@tastedev.netSostieni TASTEDEV
ProdottiGamma di prodottiAcquistaDocsDownloadMarketplaceAssistenza
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrina
NormeChi siamoInformativa sulla privacyTermini di servizioCondizioni di abbonamentoRimborsiLinee guida della community
AccountAccediRegistrati
Visitatori
Oggi
Ieri
Visualizzazioni totali
Società
GXSOFT
Rappresentante
CHOI YOUNG GU
Numero di registrazione
853-44-00368
Indirizzo
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefono
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsabile privacy
CHOI YOUNG GU

© 2026 TASTEDEVLe informazioni sui prodotti si basano su fonti di sviluppo verificate.Rilasciato · in miglioramento

Documentazione di Java
Java
Getting StartedSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts
Discussioni

Guida a Java · 3/6

Types and Data

Per ora questo capitolo è disponibile solo in inglese.

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.

Domande su questo capitolo?
Capitolo precedenteSyntax BasicsCapitolo successivoModules 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 commenti

Commenti principaliPrima i più recenti

Accedi · Accedi per lasciare un commento.