Try to find out the output of this code:
public class Test { public static void main(String[] args) { System.out.println(45+5 + "=" +45+5); } }
Output:
50=455
The reason behind this is often – Initially the integers are added and we get the L.H.S. as 50. But, as soon as a string is encountered it's appended and that we get “50=” . Now the integers after ‘=’ also are considered as a string then are appended.
public class Test { public static void main(String[] args) { System.out.println(45+5 + "=" +(45+5)); } }
Output:
50=50
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.