Answer Posted / sitaram
casting means one type of date to another type of data.
There are two types
1.Implicit Type Casting.
2.Explicit Type Casting.
public class One {
static short i=10;
int k =i; //implicit
byte b = (byte)i;//Explicit
public static void main(String[] args) {
System.out.println("integer i..."+i);
}
}
1.Implicit Casting :
===================
The small data type will be automatically covert to big data
type.
Example:
static short i=10;
int k =i; //implicit
2.Explicit Casting:
===================
The big data type will be convert to small data type by type
casting.
Example:
static short i=10;
byte b = (byte)i;//Explicit
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is the difference between a field variable and a local variable?
Difference between java and javascript
What is empty string literal in java?
What is the benefit of inner classes in java?
Can finally block be used without a catch?
What is exception in java?
What do you mean by garbage collection used in java?
What are nested classes in java?
What is hash in java?
What is the gregoriancalendar class in java programming?
How do you override a variable in java?
How many bytes is a url?
Can we have this () and super () together?
What is sortedmap in java?
What are the benefits of operations?