File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed
Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ import java .util .*;
3+ class demo
4+ {
5+ public static void main (String []arg )
6+ {
7+ char ch ;
8+ Scanner sc =new Scanner (System .in );
9+ System .out .print ("Enter String = " );
10+ String s1 =sc .next ();
11+ for (int i =0 ;i <s1 .length ();i ++)
12+ {
13+ ch =s1 .charAt (i );
14+ if (Character .isUpperCase (ch ))
15+ {
16+ System .out .print (Character .toLowerCase (ch ));
17+ }
18+ if (Character .isLowerCase (ch ))
19+ {
20+ System .out .print (Character .toUpperCase (ch ));
21+ }
22+ if (Character .isDigit (ch ))
23+ {
24+ System .out .print ("*" );
25+ }
26+ }
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ import java .util .*;
2+ /*class string
3+ {
4+ public static void main(String arg[])
5+ {
6+ Scanner sc=new Scanner(System.in);
7+ System.out.println("Enter Name = ");
8+ char s=sc.next().charAt(0);
9+ if((s>='a' && s<='z')|| (s>='A' && s<='Z'))
10+ {
11+ System.out.println(s+"Is Aplhabate ");
12+ }
13+ if(s>='0' &&s<='9')
14+ {
15+ System.out.println(s+"Is Digit");
16+ }
17+ else
18+ {
19+ System.out.println(s+"Special Character");
20+ }
21+
22+ }
23+ }*/
24+ class demo
25+ {
26+ public static void main (String []arg )
27+ {
28+ String s1 =new String ("Shri6533" );
29+ System .out .println (s1 );
30+ for (int i =0 ;i <s1 .length ();i ++)
31+ {
32+ if ((s1 .charAt (i )>='a' && s1 .charAt (i )<='z' ) || (s1 .charAt (i )>='A' && s1 .charAt (i )<='Z' ))
33+ {
34+ System .out .print (s1 .charAt (i ));
35+ }
36+ if (s1 .charAt (i )>='0' && s1 .charAt (i )<='9' )
37+ {
38+ System .out .print ("*" );
39+ }
40+ }
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments