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
Explain the difference between an object-oriented programming language and object-based programming language?
What is a hashmap used for?
Why is stringbuffer faster than string?
What is array size in java?
What do you mean by light weight and heavy weight components?
What is the difference between interface & abstract class?
what is thread? : Java thread
What is hashing in java?
Can singleton class be cloned?
What is the difference between static class and normal class?
What does string intern() method do?
What are different types of multitasking?
Why vector is used in java?
What does the @override annotation do?
What is assembly condition codes?