**AlphaNumeric||length > 5|| ==0 then reject else Accept
b=myString.matches("[0-9]+") ? myString.length() > 5 || myString.matches("0") ? "false" : "true" : "false";
**AlphaNumeric
myString.matches("[A-Za-z0-9]+")
**Numeric
myString.matches("[0-9]+"))
**Negative
myString.matches("-[0-9]+"))
**Alphabetic
myString.matches("[A-Za-z]+")
Eg:
* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
String myString = "-123456";
System.out.println(myString.matches("[A-Za-z0-9]+"));
String a=(myString.matches("[A-Za-z]+")) ? "String1" :
(myString.matches("[0-9]+")) ? myString.length() > 5 ? ">5" : "Good" :
(myString.matches("-[0-9]+")) ? "Negative" : "none";
System.out.println("hi"+a);
if(myString.matches("[A-Za-z]+"))
{
System.out.println("String");
}
else
{ if(myString.matches("[0-9]+"))
{
System.out.println("Number");
}
}
System.out.println(myString.matches("[A-Za-z]+"));
}
}
b=myString.matches("[0-9]+") ? myString.length() > 5 || myString.matches("0") ? "false" : "true" : "false";
**AlphaNumeric
myString.matches("[A-Za-z0-9]+")
**Numeric
myString.matches("[0-9]+"))
**Negative
myString.matches("-[0-9]+"))
**Alphabetic
myString.matches("[A-Za-z]+")
Eg:
* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
String myString = "-123456";
System.out.println(myString.matches("[A-Za-z0-9]+"));
String a=(myString.matches("[A-Za-z]+")) ? "String1" :
(myString.matches("[0-9]+")) ? myString.length() > 5 ? ">5" : "Good" :
(myString.matches("-[0-9]+")) ? "Negative" : "none";
System.out.println("hi"+a);
if(myString.matches("[A-Za-z]+"))
{
System.out.println("String");
}
else
{ if(myString.matches("[0-9]+"))
{
System.out.println("Number");
}
}
System.out.println(myString.matches("[A-Za-z]+"));
}
}