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 type of value does sizeof return?
How does callback work in java?
What is the difference between the boolean & operator and the && operator in java programming?
Why constructor has no return type?
Is java jre still free?
What is the difference between import java.util.date and java .util?
What is instanceof keyword?
What is the constructor?
Give us a program to check for parenthesis matching using stack.
Can we call virtual funciton in a constructor ?
Is java 9 released?
What is hashing in java?
What is the collection interface?
What are the different types of java?
What is a priority queue java?