From 2b773746dfbb998842424671dbc0f2887e94ec47 Mon Sep 17 00:00:00 2001 From: Shubham Agrahari Date: Sat, 4 Jan 2025 01:29:32 +0530 Subject: [PATCH 1/6] New --- Typconversion.class | Bin 0 -> 682 bytes Typconversion.java | 11 ++++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 Typconversion.class diff --git a/Typconversion.class b/Typconversion.class new file mode 100644 index 0000000000000000000000000000000000000000..b7ac32b6e5ff11d4f33d0d35cd32dfcb9f42b2a0 GIT binary patch literal 682 zcmZuu+fExX5Is&d*<@J?godUq7Xt-0NyEN#=}Xl}ks?|tC=%ky2`)0)c%#Kjnjh%@ zl!qX-Qa_*{Rdu}dhQw;+@z`h1oH_pS^Xqp2#|S;-kaywuD4@u&cqMK`7zuqDz8_r4 zp7 zX(JOZxK2j{nH+dn#FC4Ok7Yb%Sbn6C!5v$gNE35#Pn~HbUZpP&>wOn13`<#QYE%^V zhC*wZSh+PH&+&pGr)>3KT^&76|LF2i#j15+jiL6NpQQf}srM~t!w1JE$1Z01 zOzD)c&CoiDCwwCLL`4xF#`;DkhAaBDiTTGU7KUF4BeJ)t~_Afw??Je{ic{miCw{R=-Gc0^V_3ReU y?(nkPoMHXgo^R3l>gP6XcV>9?k8m9>l{)l11u~(C8s(g_ZEDegM=e@e!~I_wgOyeQ literal 0 HcmV?d00001 diff --git a/Typconversion.java b/Typconversion.java index ea5d37c..f3d4328 100644 --- a/Typconversion.java +++ b/Typconversion.java @@ -1,5 +1,14 @@ +import java.util.*; public class Typconversion { - + public static void main(String args[]){ + System.out.println("Enter a number:"); + Scanner sc = new Scanner(System.in); + int x = sc.nextInt(); + System.out.println("Now we will convert it into float data type:-"); + float y = x; + System.out.println(y); + } + // This is called implicit or widening type conversion. } /*1. Type Conversion occurs when we convert a data type into another data type. 2. For Conversion, data type should be compatible with another data type e.g. we can From d4fe3773796666a3448309e21594d1612afc76ec Mon Sep 17 00:00:00 2001 From: Shubham Agrahari Date: Sun, 5 Jan 2025 00:24:23 +0530 Subject: [PATCH 2/6] new --- Typecast.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Typecast.java diff --git a/Typecast.java b/Typecast.java new file mode 100644 index 0000000..569c126 --- /dev/null +++ b/Typecast.java @@ -0,0 +1,12 @@ +public class Typecast { + public static void main(String args[]){ + float x= 10.899f; + int y = (int)x; + System.out.println(y); + } + +} +/* + TypeCasting/Explicit/Narrowing Conversion:- + + */ From 788b78f03cb2f6e4f0315dd2d5d3aac0026515b4 Mon Sep 17 00:00:00 2001 From: Shubham Agrahari Date: Sun, 5 Jan 2025 00:31:58 +0530 Subject: [PATCH 3/6] "New" --- Typecast.class | Bin 0 -> 405 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Typecast.class diff --git a/Typecast.class b/Typecast.class new file mode 100644 index 0000000000000000000000000000000000000000..47d3ac01b4a24e9add207e29472de68639c15b34 GIT binary patch literal 405 zcmZutT}uK%6g^i*SGV<}HSNnDq8IH!p;t4AA_&9+#h0FDZIF@ukaZ3G4gH#WDCnUd z(2t7lY(xajz&&^7o^$TZ{rG%)2hc~;Mh006!a)vsLUk@5WY?GBtb60l)ifdGPj#r1 zGeWl2o`~~~H!PwE+rowe2cS7Y&vjJ zBh>!k5Uhn!_#r{GuGG^yk0;yTlXx)AH zPJhCUbvWy_Cj@&Gt>US=(uQ36G3=N(;1F9p46`yIGY*aoJ{>R;WA6AB^u!5ao1-b4 syoep_G8*cMnI>b|wJwhy`_CveUr_$lxDZ^;@)oSmp_IDp@m&V{UyPVd*8l(j literal 0 HcmV?d00001 From a5b56e2605ec88254ea6c7279f24ffe73f782390 Mon Sep 17 00:00:00 2001 From: Shubham Agrahari Date: Sun, 5 Jan 2025 00:34:00 +0530 Subject: [PATCH 4/6] "new" --- Typecast.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Typecast.java b/Typecast.java index 569c126..152619c 100644 --- a/Typecast.java +++ b/Typecast.java @@ -1,7 +1,7 @@ public class Typecast { public static void main(String args[]){ float x= 10.899f; - int y = (int)x; + int y = (int) x; System.out.println(y); } From 89ab9d77eb13c3dae489fdaf20df9524bf948423 Mon Sep 17 00:00:00 2001 From: Shubham Agrahari Date: Sun, 5 Jan 2025 00:45:49 +0530 Subject: [PATCH 5/6] "new" --- Typecast.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Typecast.java b/Typecast.java index 152619c..1ddd088 100644 --- a/Typecast.java +++ b/Typecast.java @@ -1,8 +1,8 @@ public class Typecast { public static void main(String args[]){ - float x= 10.899f; - int y = (int) x; - System.out.println(y); + float a= 10.899f; + int b = (int) a; + System.out.println(b); } } From 455a71632ed84a80ece5144a94938289fe45dd9f Mon Sep 17 00:00:00 2001 From: Shubham Agrahari Date: Sun, 5 Jan 2025 00:52:26 +0530 Subject: [PATCH 6/6] "new" --- Typecast.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Typecast.java b/Typecast.java index 1ddd088..5d941b5 100644 --- a/Typecast.java +++ b/Typecast.java @@ -1,7 +1,7 @@ public class Typecast { public static void main(String args[]){ float a= 10.899f; - int b = (int) a; + int b = (int)a; System.out.println(b); }