Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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;
 
PREVIOUS NEXT
Tagged: #explicit #casting
ADD COMMENT
Topic
Name
2+7 =