View All Java Casting Operations

View All Java Casting Operations


    A) Introduction

  1. Data Type Casting (Type Conversion)
byte TO short int long float double char boolean
short TO byte int long float double char boolean
int TO byte short long float double char boolean
float TO byte short int long double char boolean
double TO byte short int long float char boolean
char TO byte short int long float double boolean
boolean TO byte short int long float double char
    B) General

  1. Object Casting

2 thoughts on “View All Java Casting Operations

  1. mohit

    sir, i got alot confusion in casting operations please provide me some notes and also here is one prog in which how should we do casting
    public class main{
    public static void main(String[] args){
    Test t = new Test();
    String s1 = new String();
    String s2 = new String();

    s1 =t.a;
    s2 =t.b;

    if (s1==s2){
    System.out.println(“equal memory”);
    }
    else{
    System.out.println(“diffent memory”);
    }
    }

    }

    in another java file ****************
    public class Test{
    int a= 20;
    int b=20;
    }

Leave a Reply

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