dingdong-man
Baseband Member
- Messages
- 66
i'm trying to make a simple console application here that would be simplified by importing some class from Java.
import static java.lang.Character.isLowerCase;
import static java.lang.Character.isUpperCase;
import static java.lang.Character.isDigit;
public class LetterCheck{
public static void main(String[] args){
char symbol = 'A';
symbol = (char)(128*Math.random());
if (isUpperCase(symbol)){
System.out.println("It is CAPITAL letter ("+symbol+")");
}else {
if(isLowerCase(symbol)){
System.out.println("It is small letter ("+symbol+")");
}else {
System.out.println("It is NOT a letter ("+symbol+")");
}
}
}
}
i just wondering that if i remove the "static" in the import static, it won't work.. when do we put "static" in the import statement and when do not?
import static java.lang.Character.isLowerCase;
import static java.lang.Character.isUpperCase;
import static java.lang.Character.isDigit;
public class LetterCheck{
public static void main(String[] args){
char symbol = 'A';
symbol = (char)(128*Math.random());
if (isUpperCase(symbol)){
System.out.println("It is CAPITAL letter ("+symbol+")");
}else {
if(isLowerCase(symbol)){
System.out.println("It is small letter ("+symbol+")");
}else {
System.out.println("It is NOT a letter ("+symbol+")");
}
}
}
}
i just wondering that if i remove the "static" in the import static, it won't work.. when do we put "static" in the import statement and when do not?