Can byte value cast to double

Can byte value cast to double ?

Answer : Yes its called implicit casting or value promotion in java. Please see example below:

public class OperatorAssociativeTest {

    public static void main(String[] args) {

	double d;
	byte b = 34;
	d = b;
	System.out.println(b);
    }

}

 

Output:

Can byte value cast to double

Leave a Reply

Your email address will not be published. Required fields are marked *