Jump to content

Java | Converting String to Int & Int to String

- - - - -

  • Please log in to reply
No replies to this topic

#1
QuackWare

QuackWare

    Learning Programmer

  • Members
  • PipPipPip
  • 95 posts
String to Int originally posted here:

Java | Language Basics | Convert | Convert string to int | Free Code Snippets

Code:


/** This code snippet was taken from freecodesnippets.com*/


 


 


 


public class ConvertStringToInt {


public static void main(String[] args) {


String aString = "78";


int aInt = Integer.parseInt(aString);


 


System.out.println(aInt);


}


}

Int to String originally posted here:

Java | Language Basics | Convert | Convert int to string | Free Code Snippets


/** This code snippet was taken from freecodesnippets.com*/



public class ConvertIntToString {


public static void main(String[] args) {


 


int aInt = 1;


 


String aString = Integer.toString(aInt);


 


}


}





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users