-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupperlower.java
More file actions
36 lines (31 loc) · 864 Bytes
/
Copy pathupperlower.java
File metadata and controls
36 lines (31 loc) · 864 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
package basicjava_pac;
import java.util.Scanner;
public class upperlower {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
String s;
char m;
// boolean z;
s=sc.nextLine();
//String o,p;
char []arr=new char[s.length()];
for(int i=0;i<s.length();i++)
{
// o=s;
m=s.charAt(i);
// z=Character.isUpperCase(m);
//p= " "+ z;
if(Character.isUpperCase(m)==true){
m= Character.toLowerCase(m);
arr[i]=m;
}
else{
m=Character.toUpperCase(m);
arr[i]=m;
}
}
for (int j=0;j<arr.length;j++){
System.out.print(arr[j]);
}
}
}