
Patrick B. answered 04/05/20
Math and computer tutor/teacher
/***********************************************************************
#1) FALSE
method does not return a value, the return type is void
#2) INCORRECT !!!
AND has priority over OR
so the middle gets evaluated first
!( true || true && false || !true )
=!( true || false || !true)
=!(true)
=false
#3) True.. you must declare the size of the array
#4) FALSE... do while statement executes at least once
#5) FALSE... that syntax is not correct...
#6) TRUE
#7) It is syntactically correct; the string compare returns
true which gets output
#8) FALSE. the default case can appear anywhere in the switch
#9) Yes, they are local vars
#10) The syntax is incorrect
**********************************************************************/
//import java.*.*;
class Junk
{
public static void main(String args[])
{
boolean x = !(true || true && false || !true) ;
System.out.println(x);
String str = new String(" Dogs, cats and pigeons ");
int iIndex = str.indexOf(",");
System.out.println(iIndex);
System.out.print("Hi".compareTo("Hi") == 0);
int X=5;
switch (X)
{
default: { break; }
case 0: { System.out.println("nothing"); break; }
case 1:
case 2:
{
System.out.println(" something ");
break;
}
} //switch
int array[] = new int[10];
}
}