Like Us

header ads

Reference Data Types

Reference Datatypes


Reference variables are created using defined constructors of the classes. They are used to access objects. These variables are declared to be of a specific type that cannot be changed. For example, Employee, Puppy, etc.

Java Literals


A literal is a source code representation of a fixed value. They are represented directly in the code without any computation.
Literals can be assigned to any primitive type variable. For example −
byte a = 68;
char a = 'A';

Notation
Character represented
\n
Newline (0x0a)
\r
Carriage return (0x0d)
\f
Formfeed (0x0c)
\b
Backspace (0x08)
\s
Space (0x20)
\t
tab
\"
Double quote
\'
Single quote
\\
backslash
\ddd
Octal character (ddd)
\uxxxx
Hexadecimal UNICODE character (xxxx)


Post a Comment

1 Comments