Java Tutorial

Runtime
java 21.0.12
Files
60 files · 24 KB
Runs
50 runs
Published
sessionFive/TypeCasting.java531 B
package sessionFive;​// byte -> short and char -> int -> long -> float -> doublepublic class TypeCasting {    public static void main(String[] args) {        double price = 99.99;        // int a = price; error: possibly lossy conversion        int p = (int) price;        System.out.println(p);​        int big = 130;        byte b = (byte) big;        System.out.println(b);​        (int) 99.99 isme decimal waala hissa gir jaayega​            999999 -> 000000​            0->1->2->3->4->5->6->7->8->9->0->1    }}​