Skip to content

Commit 7b0ceeb

Browse files
authored
Add files via upload
1 parent e2a97cb commit 7b0ceeb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

string/validname.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import java.util.*;
2+
class string
3+
{
4+
public static void main(String arg[])
5+
{
6+
int f=0;
7+
char ch;
8+
Scanner sc=new Scanner(System.in);
9+
System.out.println("Enter Name = ");
10+
String s=sc.next();
11+
for(int i=0;i<s.length();i++)
12+
{
13+
ch=s.charAt(i);
14+
if((Character.isLowerCase(ch) || Character.isUpperCase(ch) ) && (Character.isDigit(ch)))
15+
{
16+
f=1;
17+
}
18+
}
19+
if(f==1)
20+
{
21+
System.out.println("Name Is Valid ");
22+
}
23+
else
24+
{
25+
System.out.println("Name Is Not Valid ");
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)