if you have an if(boolean && otherBoolean) statment, and the first boolean is false, will Java check the otherBoolean anyway? What I'm thinking is having something like this:
if( text.length()>=4 && text.subString(0,4).equals("~yay") ){
//do stuff
}
because the subString method will throw an error if text is less then 4 characters long, I feel like I need to have two if statements
if(text.length()>=4){
if(text.subString(0,4).equals("~yay"){
//do stuff
}}
but that is very ineffective to do. I suppose I could write a method, something like
public boolean beginsWith(String text, String replace){
if(replace.length()>text.length()){return false;)
if(text.subString(0,replace.length()).equals(replace)){return true;}
return false;
I know I could just use that, but I really just want to know if I can use the first option.