+92 332 4229 857 99ProjectIdeas@Gmail.com

Conversion - String To Integer And Vice Versa (C#.net Vs Java)


Conversion - String To Integer And Vice Versa
The following code shows you convert from integer data type to string data type and vice versa in both languages (C#.net and Java)

Code

Integer To String Conversion
In C#.net
       int no = 23456;
       string str = no.ToString();
       Console.WriteLine(str);
In Java
       int a = 10;
       String str = Integer.toString(a);
       System.out.println(str);
Or,
Using wrapper class Integer of int data type.
       Integer a = 10;
       String str = a.toString();
       System.out.println(str);

String To Integer Conversion
In C#.net
       string str = "2345";
       int no = int.Parse(str);
       Console.WriteLine(no);
In Java
String number = "4321";
       int a = Integer.parseInt(number);
       System.out.println(a);

0 comments: