Advertisement
ryanblume11

string practice

Nov 13th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. //Ryan Blume
  2. //Java Practice
  3. //11/12/19
  4. public class Strings
  5. {
  6. public static void main(String args[])
  7. {
  8. String s1 = ("The quick brown fox jumps over the lazy dog");
  9. String s2 = ("Mississippi");
  10. String s3 = ("Ryan Blume");
  11. String s4 = ("mississippi");
  12.  
  13. int l1 = (s1.length());
  14. System.out.println(l1);
  15. int l2 = (s2.length());
  16. System.out.println(l2);
  17. int l3 = (s3.length());
  18. System.out.println(l3);
  19. int l4 = (s4.length());
  20. System.out.println(l4);
  21. if(s2.equals(s4))
  22. {
  23. System.out.println(s2 + " and " + s4 + " are the same");
  24. }
  25. else
  26. {
  27. System.out.println(s2 + " and " + s4 +" are not the same");
  28. }
  29. if(s2.equalsIgnoreCase(s4))
  30. {
  31. System.out.println(s2 + " and " + s4 + " are the same when ignoring case");
  32. }
  33. else
  34. {
  35. System.out.println(s2 + " and " + s4 +" are not the same when ignoring case");
  36. }
  37. System.out.println(toUpperCase(String s1));
  38. System.out.println(toUpperCase(String s2));
  39. System.out.println(toUpperCase(String s3));
  40. System.out.println(toUpperCase(String s4));
  41.  
  42.  
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement