Sunaki Sunaki - 28 days ago 8
Java Question

why did the second String is didn't printed? when i erase "+"

public class Output2 {
public static void main(String[] args) {
System.out.println("belajar ");
System.out.println("pemrograman" "java");
}
}


Why did the second String is didn't printed? when i erase "+"
enter image description here

Answer Source

Basically "+" is used for concatenation. When you remove it from your output statement compiler doesn't get what to do with the second string. use it like this

public class Output2 {
    public static void main(String[] args) {
        System.out.println("belajar ");
        System.out.println("pemrograman"+"java");