fork download
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package homework.pkg4;
  7.  
  8. /**
  9.  *
  10.  * @author Shovanjit Khatua
  11.  */
  12. public class Homework4 {
  13.  
  14. /**
  15.   * @param args the command line arguments
  16.   */
  17. public static void main(String[] args) {
  18. String myString= "adkmcbfza";
  19. int index = 0;
  20. while (myString.charAt(index) <= myString.charAt(index + 1)) {
  21. index++;
  22. }
  23.  
  24. if(index==myString.length()) index=-1;
  25. System.out.println(index);
  26. }
  27.  
  28. }
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: class Homework4 is public, should be declared in a file named Homework4.java
public class Homework4 {
       ^
1 error
stdout
Standard output is empty