Horje
Converting data in java Code Example
Converting data in java
// Java Program to Illustrate Conversion of
// Integer and Double to Byte
 
// Main class
class GFG {
 
    // Main driver method
    public static void main(String args[])
    {
        // Declaring byte variable
        byte b;
 
        // Declaring and initializing integer and double
        int i = 257;
        double d = 323.142;
 
        // Display message
        System.out.println("Conversion of int to byte.");
 
        // i % 256
        b = (byte)i;
 
        // Print commands
        System.out.println("i = " + i + " b = " + b);
        System.out.println(
            "\nConversion of double to byte.");
 
        // d % 256
        b = (byte)d;
 
        // Print commands
        System.out.println("d = " + d + " b= " + b);
    }
}




Java

Related
consumer Code Example consumer Code Example
convert python to java Code Example convert python to java Code Example
+= in java Code Example += in java Code Example
Caused by: java.lang.IllegalStateException: stream has already been operated upon or closed Code Example Caused by: java.lang.IllegalStateException: stream has already been operated upon or closed Code Example
two array structures in java Code Example two array structures in java Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8