#9 What is String in Java

Published: 18 June 2023
on channel: Nilesh Kavankar
87
1

In this video, I have explained What is a string variable in Java & it's methods.

Definition:
String is a variable contains a collection of characters/text surrounded by double quote.
For example String s = “JavaSession”;

In Java, String is basically an object which provides a lot of methods that can perform specific operations on strings such as
compare(), concat(), equals(), split(), length(), toUpperCase(), toLowerCase() etc.

String Concatenation:
In Java, String concatenation forms a new String that is the combination of multiple strings. There are two ways to concatenate strings in Java:
i. By + operator
ii. By concat() method

Note: Java uses the + operator for both addition and concatenation.
Always remember: Numbers are added. Strings are concatenated
If you add two numbers, the result will be a number
If you add two strings, the result will be a string concatenation
If you add a number and a string, the result will be a string concatenation:


On this page of the site you can watch the video online #9 What is String in Java with a duration of hours minute second in good quality, which was uploaded by the user Nilesh Kavankar 18 June 2023, share the link with friends and acquaintances, this video has already been watched 87 times on youtube and it was liked by 1 viewers. Enjoy your viewing!