-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringLiteralAndStringClass.java
More file actions
44 lines (34 loc) · 952 Bytes
/
StringLiteralAndStringClass.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
package stringConcept;
import java.util.Scanner;
public class StringLiteralAndStringClass {
public static void main(String[] args) {
//String Literal and String Object
String str = "Padmapriya";
String str1 = "Padmapriya";
String s = new String("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
String val;
char a, b;
boolean flag;
Scanner inp = new Scanner(System.in);
System.out.println("Enter the String contains Lower and Upper");
val = inp.nextLine();
int num;
for(int i = 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");
}
}
}