literal
A value written directly in source code, such as 42, 3.5, "hi" or true.
In more detail
A literal means exactly what it says, whereas an identifier is a name that refers to a value stored elsewhere. Each type has its own literal form, such as quotes for strings and digits for numbers. In many languages the form also decides the exact type, so 42 and 42.0 are different kinds of number.
Examples
9000000000L"ready"Related terms
- long — Java's primitive type for whole numbers too large for int, stored in 64 bits.
- text block — A multi-line string literal opened and closed by three double quotes, whose common indentation is removed automatically.
- primitive type — A basic built-in type, such as a whole number or true-or-false, whose values are held directly rather than as objects.
- identifier — A name for a thing in code, such as a variable, function or module name.
- string — A sequence of characters, that is, a piece of text.
- integer — A whole number with no fractional part, such as 7, 0 or -12, which Python calls int.
Taught in
- Primitive And Reference Types — Modern Java: Virtual Threads & High-Throughput Services
- Pattern Matching And Text Blocks — Modern Java: Virtual Threads & High-Throughput Services
- Promotion, Wrappers And The Math API — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Strings, StringBuilder And Text Blocks — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Switch, Loops And Labels — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Strings, Delimiters And Concatenation — Hands-on Python: Complete Video Course & Book
- Variables And Assignment — Hands-on Python: Complete Video Course & Book
- Literals, Identifiers And Keywords — Hands-on Python: Complete Video Course & Book
- The Print Function And String Literals — Hands-on Python: Complete Video Course & Book
- Chapter One In One Sitting — Hands-on Python: Complete Video Course & Book
- Thirty Questions, One Sneaky Print — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Interpreter, Compiler, And What Counts As Syntax — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Literals, Names And Four Number Bases — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Print, Input And The Casts Between — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Fundamentals Sprint — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Tuples, And The Comma That Makes Them — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Dictionaries: Keys, Values And Items — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Strings: Escapes, Slices And Methods — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Characters As Numbers — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep