+ 3

I method we have given return type String but in parameters can we pass integer.

private String createCalendarEventReminder(String eventName, String location, int minutesAway) {     String reminder = "You have an upcoming event in " + minutesAway + " minutes.";     reminder = reminder + " It is " + eventName + " held at " + location + ".";     return reminder; }

31st Mar 2018, 9:12 PM
Code Race
Code Race - avatar
2 Answers
+ 2
When you use this anint + astring, the int's toString() method is called, which returns a String. reminder is a string.
31st Mar 2018, 9:30 PM
Jonas Schröter
Jonas Schröter - avatar
0
The only overloaded operator in Java “+”
1st Apr 2018, 2:07 PM
gtbandc
gtbandc - avatar