Anophoo

strings

Nov 29th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import acm.program.ConsoleProgram;
  2.  
  3. public class Midterm2015 extends ConsoleProgram{
  4.  
  5. public void run() {
  6. // System.out.println("abc");
  7. // String cde = "cde";
  8. // System.out.println("abc" + cde);
  9. // String c = "abc".substring(2,3);
  10. // String d = cde.substring(1, 2);
  11. // System.out.println(c);
  12. // System.out.println(8 + " bla");
  13. //
  14. // String str = "abcdef";
  15. // String newString = str.substring(1, 3);
  16. // String newString2 = str.substring(1);
  17. //
  18. // System.out.println(newString);
  19. // System.out.println(newString2);
  20. //
  21. // String s = "wertyui"; // 7
  22. // int sizeOfString = s.length(); // 7
  23. // for (int i = 0; i < sizeOfString; i++) {
  24. // char ch = s.charAt(i);
  25. // System.out.println(ch);
  26. // }
  27. //
  28. // String s2 = "sorry";
  29. // boolean ans = s2.contains("" + 's');
  30. // if (ans) {
  31. // System.out.println("contains");
  32. // } else {
  33. // System.out.println("doesn't contain");
  34. // }
  35. //
  36. // String s3 = "ab";
  37. // String s4 = "ac";
  38. // System.out.println(s3.compareTo(s4));
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment