Last active
August 31, 2021 12:10
-
-
Save minte9/f04491a328cc4c9e98deea22ad1d560c to your computer and use it in GitHub Desktop.
Java / Basics / Strings - https://www.minte9.com/java/basics-strings-1219
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
/** | |
* Define a string s1 = "1" | |
* Define a number n1 = 2 | |
* Display the sum of s1 + n1 = 3 | |
* (convert the string to number) | |
*/ | |
class App { | |
public static void main(String[] args) { | |
/** | |
* SOLUTION | |
*/ | |
String s1 = "1"; | |
int n1 = 2; | |
System.out.println(n1 + Integer.valueOf(s1)); // 3 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment