You are on page 1of 8

range

byte -128 to 127


short -32768 to 32767
char 0 to 65535
int -2147483648 to 2147483647
long
float -3.4e38 to 3.4e38
double -1.7e308 to 1.7e308

Widenting first and autoboxing second(widening followed by auto boxing) not


implemented in java

Literal

primitive = primitive
Wrappers = primitive
primitive = Wrappers ----------------

Variable

primitive Var = primitive Var


Wrapper var = primitive var
primitive va = wrapper var --------------------

Literal ////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////

primitive to primitive

int literal
byte = int (-128 ) to 127 | compile error -> byte casting

short = int (-2 15) to 2 15 -1 | compile error -> short casting

char = int 0 to (2 16-1) | compile error -> char casting

int = int (-2 31) to (2 31 -1)

long = int (-2 31) to (2 31 -1) | compile error -> long casting

float = int (-2 31) to (2 31 -1) | compile error -> float casting

double = int (-2 31) to (2 31 -1) | compile error -> double casting

char literal
byte = char as above until char value == to char limit
short = char
char = char
int = char
long = char
float = char
double =char

long literal
byte = long compile error -> byte casting

short = long compile error -> short casting

int = long compile error -> int casting

char = long compile error -> char casting

long = long -2 63 to 2 63-1

float = long can

double = long can

float literal
byte = float compile error -> byte casting

short = float compile error -> short casting

int = float compile error -> int casting

char = float compile error -> char casting

long = float compile error -> long casting

float = float can

double = float can

double literal
byte = double compile error -> byte casting

short = double compile error -> short casting

int = double compile error -> int casting

char = double compile error -> char casting

long = double compile error -> long casting

float = double compile error -> float casting

double = double Can

Wrappers <-
primitive /////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////

int literal

Byte = int
same as primitive to primitive literal int
Character = int
Short = int

Integer = int
======================================================
Long = int compile error -> long casting

Float = int compile error -> float casting No widening and


autoboxing at the same time

Double = int compile error -> double casting

char literal

Byte = char

Short = char

Character = char

Integer = char = this and follow compilation error casting works

Long = char

Float = char

Double = char

long literal

Byte = long compile error -> byte casting

Short = long compile error -> short casting

Character = long compile error -> char casting Same as primitive to


primitive literal long

Integer = long compile error -> int casting

Long = long can

Float = long compile error -> float casting

Double = long compile error -> double casting

float literal

Byte = float compile error -> byte casting

Short = float compile error -> short casting

Integer = float compile error -> int casting as primitive to


primitive float literal
Long = float compile error -> long casting

Float = float can

Double = float compile error -> double casting no widening and


autoboxing

double literal

Byte = double compile error -> byte casting

Short = double compile error -> short casting

Integer = double compile error -> int casting

Long = double compile error -> long casting

Float = double compile error -> float casting

Double = double can

primitiveVariable to
primitiveVariable ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////
equal to primi vari = wrapper vari
byte variable

byte = byteVariable
short = byteVariable
int = byteVariable
char = byteVariable compile error others can | char -> casting
long = byteVariable
float = byteVariable
double = byteVariable

short variable

byte = shortVariable compile error | byte ->


short = shortVariable
int = shortVariable
char = shortVariable compile error others can | char -> casting
long = shortVariable
float = shortVariable
double = shortVariable

char variable

byte = charVariable compile error | byte ->


short = charVariable compile error | short ->
int = charVariable
char = charVariable
long = charVariable
float = charVariable
double = charVariable

int variable

byte = intVariable compile error | byte ->


short = intVariable compile error | short ->
char = intVariable compile error others can | char -> casting
int = intVariable
long = intVariable
float = intVariable
double = intVariable

long variable

byte = longVariable compile error | byte ->


short = longVariable compile error | short ->
int = longVariable compile error | int ->
char = longVariable compile error others can | char -> casting
long = longVariable
float = longVariable
double = longVariable

float variable

byte = floatVariable compile error | byte ->


short = floatVariable compile error | short ->
int = floatVariable compile error | int ->
char = floatVariable compile error others can | char -> casting
long = floatVariable compile error | long ->
float = floatVariable
double = floatVariable

double variable

byte = doubleVariable compile error | byte ->


short = doubleVariable compile error | short ->
int = doubleVariable
char = doubleVariable compile error others can | char -> casting
long = doubleVariable
float = doubleVariable
double = doubleVariable only can

Wrapper variable =
primitiveVariable /////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

byte variable

Byte = byteVariable only can others by casting


Short = byteVariable
Integer = byteVariable
Character = byteVariable
Long = byteVariable
Float = byteVariable
Double = byteVariable
short variable

Byte = shortVariable
Short = shortVariable only can others by casting
Integer = shortVariable
Character = shortVariable
Long = shortVariable
Float = shortVariable
Double = shortVariable

char variable

Byte = charVariable
Short = charVariable
Integer = charVariable
Character = charVariable only can others by casting
Long = charVariable
Float = charVariable
Double = charVariable

int variable

Byte = intVariable
Short = intVariable
Integer = intVariable only can others by casting
Character = intVariable
Long = intVariable
Float = intVariable
Double = intVariable

float variable

Byte = floatVariable
Short = floatVariable
Integer = floatVariable
Character = floatVariable
Long = floatVariable
Float = floatVariable only can others by casting
Double = floatVariable

double variable

Byte = doubleVariable
Short = doubleVariable
Integer = doubleVariable
Character = doubleVariable
Long = doubleVariable
Float = doubleVariable
Double = doubleVariable only can others by casting

primitiveVariable = Wrapper
variable /////////////////////////////////////////////////////////////
////////////////////////////////////////////
equal to primi vari = primi vari

Byte wrapper
byte = ByteVariable
short = ByteVariable
char = ByteVariable Cannot
int = ByteVariable
long = ByteVariable
float = ByteVariable
double = ByteVariable

Short wrapper

byte = ShortVariable Cannot


short = ShortVariable
char = ShortVariable Cannot
int = ShortVariable
long = ShortVariable
float = ShortVariable
double = ShortVariable

Character wrapper

byte = CharacterVariable Cannot


short = CharacterVariable Cannot
int = CharacterVariable
char = CharacterVariable
long = CharacterVariable
float = CharacterVariable
double = CharacterVariable

Integer wrapper

byte = IntegerVariable Cannot


short = IntegerVariable Cannot
char = IntegerVariable Cannot
int = IntegerVariable
long = IntegerVariable
float = IntegerVariable
double = IntegerVariable

Long wrapper

byte = LongVariable cannot


short = LongVariable cannot
int = LongVariable cannot
char = LongVariable cannot
long = LongVariable
float = LongVariable
double = LongVariable

Float wrapper

byte = FloatVariable cannot


short = FloatVariable cannot
int = FloatVariable cannot
char = FloatVariable cannot
long = FloatVariable cannot
float = FloatVariable
double = FloatVariable

Double wrapper
byte = DoubleVariable
short = DoubleVariable
int = DoubleVariable
char = DoubleVariable
long = DoubleVariable
float = DoubleVariable
double = DoubleVariable only can

java 9 features

jshell
jpms
jlinq
http/2 client
process api update
<>
private method in interface
factory methods for immutable collections
stream enhancement
gigc
verg ann
try resource

java 8

lamda
stream
joda
static
functional
defaul
pred
funct
consum
:: con me

You might also like