-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrings.java
53 lines (31 loc) · 1.09 KB
/
strings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.util.*;
public class strings {
public static void main(String[] args) {
String name =" bhess";
Scanner kl= new Scanner(System.in);
String a= kl.next();
String b= kl.next();
/*
System.out.println(a);
System.out.println(a+b);
System.out.println(a.length());
//transversing in string
//charAt
for (int i=0;i<a.length();i++){
System.out.println(a.charAt(i));
}
*/
if (a.compareTo(b)==0){
System.out.println("equal" );
}else{
System.out.println("unequal");
if (a.compareTo(b)>0){
System.out.println("a is greater " );}
else{
System.out.println("b is greater");}
}
String nanu="crocoOO is alive";
System.out.println(nanu.substring(0,5));
//strings are immutable
}
}