0% found this document useful (0 votes)
3 views2 pages

Type Casting in Java Explained

The document is a Java program demonstrating type casting, specifically implicit and explicit type casting. It includes examples where an integer is converted to a float both implicitly and explicitly. The output of the program shows the values of the variables before and after the casting operations.

Uploaded by

Sahil Badhe
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Type Casting in Java Explained

The document is a Java program demonstrating type casting, specifically implicit and explicit type casting. It includes examples where an integer is converted to a float both implicitly and explicitly. The output of the program shows the values of the variables before and after the casting operations.

Uploaded by

Sahil Badhe
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practical NO:-03

/*

Practical No:- 03

Enroll : 2206005

Name : Sahil Badhe

Title : Type Casting

*/

public class Type_Casting {

public static void main(String[] args) {

// 1. Implicit Type Casting

[Link]("Implicit Type Casting");

int a = 30;

float b;

b = a;

[Link]("Value of int variable a=" + a);

[Link]("Value of float variable b=" + b);

[Link]("");

// 2. Explicit Type Casting

[Link]("Explicit Type Casting ");

int n = 60;

float m;

m = (float) n;

[Link]("Value of int variable a=" + n);

[Link]("Value of float variable b=" + m);

}
Out Put:-

You might also like