What will be the output when we compile and run the program?
public class Q1 {
static void processorB() {
System.out.println(" is a boolean Operator.");
}
static Q1 processorA(){
Q1 q=null;
if (("java").startsWith("null"))
return q;
else
return null;
}
static {
System.out.print("Java".startsWith(""));
}
public static void main(
String[] args) {
processorA().processorB();
}
}
The answer is true boolean is operator.
My first question is how come System.out.print("Java".startsWith("")). will be true. The string is empty string right?
Second question is the processorA method will return null, so how the null.processorB() is valid. Am not getting it. Please explain
Thanks in advance