- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringLiteralAndStringClass.java
More file actions
Latest commit
44 lines (34 loc) · 952 Bytes
/
Copy pathStringLiteralAndStringClass.java
File metadata and controls
44 lines (34 loc) · 952 Bytes
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
packagestringConcept;
importjava.util.Scanner;
publicclassStringLiteralAndStringClass {
publicstaticvoidmain(String[] args) {
//String Literal and String Object
Stringstr = "Padmapriya";
Stringstr1 = "Padmapriya";
Strings = newString("New Padmapriya");
if(str==str1){
System.out.println("Yes, It is equal");
}else
System.out.println("No, It is not equal");
//Program to find whether the character is Uppercase or lower case in a String
Stringval;
chara, b;
booleanflag;
Scannerinp = newScanner(System.in);
System.out.println("Enter the String contains Lower and Upper");
val = inp.nextLine();
intnum;
for(inti = 0; i < val.length(); i++){
b = val.charAt(i);
a = b;
if((Character.isLowerCase(b))){
flag = true;
}else
flag = false;
if(flag){
System.out.println(a + " is a Lowercase");
}else
System.out.println(a + " is a upper case");
}
}
}