1: public class Squares { 2: public static long square(int x) { 3: long y = x * (long) x; 4: x = -1; 5: return y; 6: } 7: public static void main(String[] args) { 8: int value = 9; 9: long result = square(value); 10: System.out.println(value); 11: } }
❌ A. -1 ✅ B. 9 ❌ C. 81 ❌ D. Compiler error on line 9. ❌ E. Compiler error on a different line
Explanation: Since Java is pass-by-value and the variable on line 8 never gets reassigned, it stays as 9. In the method square, x starts as 9. y becomes 81 and then x gets set to –1. Line 9 does set result to 81. However, we are printing out value and that is still 9.
1: public class Squares { 2: public static long square(int x) { 3: long y = x * (long) x; 4: x = -1; 5: return y; 6: } 7: public static void main(String[] args) { 8: int value = 9; 9: long result = square(value); 10: System.out.println(value); 11: } }
❌ A. -1 ✅ B. 9 ❌ C. 81 ❌ D. Compiler error on line 9. ❌ E. Compiler error on a different line
Explanation: Since Java is pass-by-value and the variable on line 8 never gets reassigned, it stays as 9. In the method square, x starts as 9. y becomes 81 and then x gets set to –1. Line 9 does set result to 81. However, we are printing out value and that is still 9.
BY Explanations “Top Java Quiz Questions”
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
The cloud-based messaging platform is also adding Anonymous Group Admins feature. As per Telegram, this feature is being introduced for safer protests. As per the Telegram blog post, users can “Toggle Remain Anonymous in Admin rights to enable Batman mode. The anonymized admin will be hidden in the list of group members, and their messages in the chat will be signed with the group name, similar to channel posts.”
What is Telegram Possible Future Strategies?
Cryptoassets enthusiasts use this application for their trade activities, and they may make donations for this cause.If somehow Telegram do run out of money to sustain themselves they will probably introduce some features that will not hinder the rudimentary principle of Telegram but provide users with enhanced and enriched experience. This could be similar to features where characters can be customized in a game which directly do not affect the in-game strategies but add to the experience.