Last active
September 16, 2019 09:59
-
-
Save youngjinmo/f90df18a4ef7773a8a3301a4e978cd99 to your computer and use it in GitHub Desktop.
String형으로 형변환 하는 방법
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class castingToString { | |
public static void main(String[] args){ | |
int a = 66; | |
double b = 3.456; | |
String c = "90"; | |
char d = 'd'; | |
System.out.println("Integer to String : " + String.valueOf(a)); | |
System.out.println("Integer to String : " + Integer.toString(a)); | |
// Integer to String : 66 | |
System.out.println("Double to String : " + String.valueOf(b)); | |
// Double to String : 3.456 | |
System.out.println("DataType Check : "+String.valueOf(b).equals("3.456")); | |
// DataType Check : true | |
System.out.println("Char to String : " + String.valueOf(a)); | |
// Char to String : d | |
System.out.println("DataType Check : "+String.valueOf(d).equals("d")); | |
// DataType Check : true | |
System.out.println("DataType Check : "+String.valueOf(d).equals('d')); | |
// DataType Check : false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment