Printing Integer between Strings in Java Last Updated : 11 Dec, 2018 Comments Improve Suggest changes Like Article Like Report Try to figure out the output of this code: Java public class Test { public static void main(String[] args) { System.out.println(45+5 + "=" +45+5); } } Output: 50=455 The reason behind this is - Initially the integers are added andĀ we get the L.H.S. as 50. But, as soon as a string is encountered it is appended and we get "50=" . Now the integers after '=' are also considered as a stringĀ and so are appended. To make the output 50=50, we need to add a bracket around the sum statement to overload the concatenation operation. This will enforce the sum to happen before string concatenation as bracket as the highest precedence. Java public class Test { public static void main(String[] args) { System.out.println(45+5 + "=" +(45+5)); } } Output: 50=50 Comment More infoAdvertise with us Next Article Printing Integer between Strings in Java K kartik Improve Article Tags : Java Java-Strings Java-Integer Java-String-Programs Practice Tags : JavaJava-Strings Similar Reads Insert a String into another String in Java Given a String, the task is to insert another string in between the given String at a particular specified index in Java. Examples: Input: originalString = "GeeksGeeks", stringToBeInserted = "For", index = 4 Output: "GeeksForGeeks" Input: originalString = "Computer Portal", stringToBeInserted = "Sci 4 min read Interning of String in Java String Interning in Java is a process of storing only one copy of each distinct String value, which must be immutable. Applying String.intern() on a couple of strings will ensure that all strings having the same contents that shares the same memory.Example:When a string is created using a string lit 4 min read Java StringBuilder delete(int start, int end) Method delete(int start, int end) method in the StringBuilder class is used to remove a portion of the string, starting from the specified start index to the specified end index. This method is used to modify mutable sequences of characters.Example 1: The below example demonstrates how to use the delete() 2 min read PrintWriter write(String, int, int) method in Java with Examples The write(String, int, int) method of PrintWriter Class in Java is used to write a specified portion of the specified String on the stream. This String is taken as a parameter. The starting index and length of String to be written are also taken as parameters. Syntax: public void write(String string 2 min read print vs println in Java print() and println() are the methods of System.out class in Java which are used to print the output on the console. The major difference between these two is that print() method will print the output on the same line while println() method will print the output on a new line.println() method can be 3 min read Like