Literals || How many types literals || books1263

Literals

Literals are constants that do not change and may be assigned to variables.
      There are seven types that can be used in java:
  1. Integer literals
  2. Floating literal
  3. Boolean literal
  4. Character literal
  5. String literal
  6. Null literal
  7. Class literal

Integer Literal:

Integer-literal are used to represent whole numbers. It may be a positive or a negative number without a point or comma(,).
  Integer are three types that can be represented in Java:
  1. Decimal(base 10)
  2. Octal(base 8)
  3. Hexadecimal(base 16)

Floating Literals:

Floating literals are used to represented fractional numbers i.e. number with a point.
  In exponential format a real number is divided into two parts: mantissa and exponent.
The mantissa represents the integer part and exponent represents 10 to the power of a number.

Boolean Literals

Boolean literals are used as an indicator to represent a success or failure i.e. true or false.

Character Literals:

Character literal are always enclosed within single quotes. These characters can directly be printed on an output device ( like terminal window ).

String Literal:

A group of characters enclosed within double quotes can be considered to be String literal.

Null Literal:

The null represents nothing.

Class Literal:

A class literal is an expression consisting of the name of a class, interface, or primitive type followed by a dot('.')

THANKS FOR VISIT MY BLOG...



Share on Google Plus

About Books

0 comments:

Post a Comment

Aryan

The Blue Planet

The Blue Planet My Dear Visitors In this blog we learn about the The Blue Planet   So lets begin ब्लू प्लैनेट एक ब्रिटिश प...