fork download
  1. import java.util.*;
  2.  
  3. class StringArrayTest
  4. {
  5. public static void main(String [] args)
  6. {
  7.  
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. String[] lolArray = new String[6];
  11.  
  12. lolArray[0] = scan.nextLine();
  13. lolArray[1] = scan.nextLine();
  14. lolArray[4] = "Dylan is watching me";
  15.  
  16.  
  17. for (int index = 0 ; index < lolArray.length ; index++ )
  18. {
  19. System.out.println(lolArray[index]);
  20.  
  21. if (lolArray[index] = null)
  22. {
  23. System.out.println("There is nothing here!");
  24. }
  25. }
  26.  
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:21: incompatible types
found   : java.lang.String
required: boolean
      if (lolArray[index] = null)
                          ^
1 error
stdout
Standard output is empty