Java – Methods & Examples

Java – Methods & Examples 2017-08-09T13:02:25+00:00

String Methods in java:

Example :


 


Output :
S1 = Bhagirath
S1 lenth = 9
S1 lowercase = bhagirath
S1 uppercase = BHAGIRATH
S1 replace a with z = Bhzgirzth
S1 indexOf(‘e’)= -1
S1 lastindexof(‘e’) = -1
S2 = ViewSonic
S1 and S2 trim = BhagirathViewSonic
S1 and S2 equals = false
S1 and S2 equals ignoring case = false
S1 and S2 compareTo = -20
S1 and S2 concate = BhagirathViewSonic
S1 substring(n) = rath
S1 substring(n,m) = rat
S1 toString() = Bhagirath
S1.valueOf(variable) = 3
Start with false
Start with false

 


Output :
 jav
 jav  jav
32
74
97
118
Welcome to Java2all

 


Output :
S1 = Rome was not built in a not day
S2 = Rome was not built in a Not day
Region Matches =
b1 = false

 


Output :
Hello equals Hello -> true
Hello == Hello -> false

Prev Next