Guest User

Untitled

a guest
Apr 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main {
  5. public static boolean compare5(String a, String b) {
  6. int len1 = a.length();
  7. int len2 = b.length();
  8.  
  9. if (len1 >= 5 && len2 >= 5) {
  10. for (int i = 0; i < 5; ++i) {
  11. if (a.charAt(i) != b.charAt(i)) {
  12. return false;
  13. }
  14. }
  15. return true;
  16. }
  17. else {
  18. return false;
  19. }
  20. }
  21.  
  22. public static void main(String[] arguments) {
  23. System.out.println(compare5("clover", "cloverfield"));
  24. }
  25. }
Add Comment
Please, Sign In to add comment