This is the third lecture of the Learn Java lecture series. In this you’ll learn about strings in Java. We will be working with text in Java and see how we can do a lot of things with it.

Let’s make a new class for strings. So do the same right click > new > class

create new class in java

then do the same as you did before give class a name and then check the main method checkbox. I’m calling this class as Texts.

class in java


To declare a string you need to write it as String with an uppercase S. It’s not small as we saw in the previous lecture int, double etc.

String Concatenation:

In other words Concatenation mean joining. Like “Hello John” is a combination of Hello [single black space] and John. So in the main method of add the following code:

Let’s concatenate other type like int with String and also see other methods of printing the concatenated values:

The last println statement is a combination of String and int printing in one.

Tags : java se tutorialstrings in java
Chaudhary Talha

The author Chaudhary Talha

I'm an iOS developer by profession and UI/UX designer by passion. All my tutorials are based on my personal experiences and whenever I learn something new I share it with the world.