Java Type Casting
Narrowing Casting (manually) - larger type to a smaller size type
double -> float -> long -> int -> char -> short -> byte
Java Type Casting
Narrowing Casting (manually) - larger type to a smaller size type
double -> float -> long -> int -> char -> short -> byte
casting in java
Primitive Type casting and Reference Type casting
PRIMITIVE CASTING:
implicit casting (casting smaller type to larger
int a = 100; double c = a;)
explicit casting (casting larger to smaller
byte b = (byte) a;
REFERENCE CASTING:
upcasting - implicitly done (casting smaller type to larger)
Collection<Integer> collection = new ArrayList<>();
downcasting (cast larger type to smaller one )
List <Integer> list = ( ArrayList ) collection;
FRAMEWORK EXAMPLE:
Up Casting, Down Casting in Multi Browser testing.
WebDriver, Chrome Driver, Firefox Driver object
I casted to WebDriver to making reference type.
Whenever you taking Screenshots,
whenever executing Java script command.
casting in java
Byte-->short-->char-->Int-->long-->float-->double
Java Type Casting
Narrowing Casting (manually) - larger type to a smaller size type
double -> float -> long -> int -> char -> short -> byte
casting in java
Primitive Type casting and Reference Type casting
PRIMITIVE CASTING:
implicit casting (casting smaller type to larger
int a = 100; double c = a;)
explicit casting (casting larger to smaller
byte b = (byte) a;
REFERENCE CASTING:
upcasting - implicitly done (casting smaller type to larger)
Collection<Integer> collection = new ArrayList<>();
downcasting (cast larger type to smaller one )
List <Integer> list = ( ArrayList ) collection;
FRAMEWORK EXAMPLE:
Up Casting, Down Casting in Multi Browser testing.
WebDriver, Chrome Driver, Firefox Driver object
I casted to WebDriver to making reference type.
Whenever you taking Screenshots,
whenever executing Java script command.
casting in java
Byte-->short-->char-->Int-->long-->float-->double
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us