Class 5
Class 5
___________________
String:
--------
-> String is a class present in java.lang.*
-> Using the object we can store the group of character or sequence of character
-> String class contains number of methods. Using these methods we can perform
multiple operation like removal of character, add character, split, etc...
-> String is immutable
class Test{
public static void main(String[] args){
String s = new String("welcome to session");
System.out.println(s);
String str2 = new String("welcome to session");
int a=10;
int b=10;
char ch='a';
}
}
O/P:
-----
welcome to session
true
true
true
c.e
false
class Test{
public static void main(String[] args){
String s = "welcome to session";
String str1 = "welcome to session";
System.out.println(s);
System.out.println(s == str1);
}
}
o/p:
-----
welcome to session
true
o/p:
-----
false
false
false
false
true
true
String ob = null;
//ob.length(); --------------> c.e
o/p:
-------
welcome to session
30welcome to session
welcome to session1020
welcome to session
welcome to session hello everyone
hellonull
___________________________________________________________