Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

explicit casting

// Explicit casting is manually casting a variable to another type

double x = 1.1;
int y = x + 2; // This won't work, because x is a double and y an integer.

// So instead do it like this:
double x = 1.1;
int y = (int)x + 2;
Comment

Explicit conversion casting

short a=2000;
int b;
b = (int) a;    // c-like cast notation
b = int (a);    // functional notation
Comment

what is explicit casting

/*
Type Casting Types in Java
   Java Type Casting is classified into two types.
       - Widening Casting (Implicit) – Automatic Type Conversion
       - Narrowing Casting (Explicit) – Need Explicit Conversion
       
source: https://www.tutorialspoint.com/what-are-the-differences-between-widening-casting-implicit-and-narrowing-casting-explicit-in-java
*/
Comment

PREVIOUS NEXT
Code Example
Java :: java add to map 
Java :: Java Create LinkedList in Java 
Java :: running sum of 1d array leetcode 
Java :: break java 
Java :: java float 0/0 
Java :: get the max value from arrayList java and save it in int 
Java :: operador ternario java 
Java :: java remove character from string after 
Java :: How to find the next greater permutation of a list of numbers, in Java? 
Java :: Java Converting int to double 
Java :: Right triangle star pattern in java 
Java :: java replaceAll ignore case 
Java :: compare two times in java 
Java :: for loop javasctip 
Java :: java array loop 
Java :: charat(0).touppercase() java 
Java :: export java_home linux 
Java :: java calendar add minutes 
Java :: testing the web layer without authentication spring 
Java :: java solid principles 
Java :: send data from service to activity class 
Java :: creating a directory using java 
Java :: this in java 
Java :: how generate a random number in java between 3 and 5 
Java :: how to delete character in string java 
Java :: java variables 
Java :: initialize hashmap with values 
Java :: render problem in android studio 
Java :: indext of minimum element in an array in java 
Java :: arrays.copy 2d array 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =