> For the complete documentation index, see [llms.txt](https://gyansetu-java.gitbook.io/core-java/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyansetu-java.gitbook.io/core-java/string/string-equality-and-operators.md).

# String equality and operators

## Concatenation:  + and +=

![](/files/-LTbV7KHWQ5XGwedadyh)

![](/files/-LTbVBQhjEyJ_Jz39qWS)

![](/files/-LTbVLCYKukebsH8p9Gn)

![](/files/-LTbVQ23FuBPmE_tlyrC)

```java
package com.test.test1;
public class StringMethods {
	public static void main(String[] args) {
		String day = "OCJA" + "Cert" + "Exam";
		System.out.println(day);
	}
}
```

```java
package com.test.test1;
public class StringMethods {
	public static void main(String[] args) {
		int num = 10;
		int val = 12	;
		String aStr = "OCJA";
		String anotherStr = num + val + aStr;
		System.out.println(anotherStr);
	}
}
```

```java
package com.test.test1;
public class StringMethods {
	public static void main(String[] args) {
		int num = 10;
		int val = 12;
		String aStr = "OCJA";
		String anotherStr = "" + num + val + aStr;
		System.out.println(anotherStr);
	}
}
```

![](/files/-LTbWZoNt1i3G2w2AXxP)

![](/files/-LTbWxP86C7_0iHo5J-d)

```java
package com.test.test1;
public class StringMethods {
	public static void main(String[] args) {
		String lang = "Java";
		lang += " is everywhere!";
		String initializedToNull = null;
		initializedToNull += "Java";
		System.out.println(initializedToNull);
	}
}
```
