Skip to content

Instantly share code, notes, and snippets.

@minte9
Last active August 31, 2021 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minte9/f04491a328cc4c9e98deea22ad1d560c to your computer and use it in GitHub Desktop.
Save minte9/f04491a328cc4c9e98deea22ad1d560c to your computer and use it in GitHub Desktop.
/**
* 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