Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public class test{
  2. public static void main(String[] args){
  3.  
  4. System.out.println(notString("not bad"));
  5. }
  6. public static String notString(String str) {
  7.  
  8. if(str.length() < 3){
  9. return "not " + str;
  10. }
  11.  
  12. String first3 = str.substring(0,3);
  13. System.out.println(first3);
  14. System.out.println(first3.length());
  15. System.out.println(first3 == "not");
  16. if(first3 == "not"){
  17. return str;
  18. }
  19. else {
  20. return "not " + str;
  21. }
  22.  
  23.  
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement