Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3. import java.util.List;
  4.  
  5. public class Ship {
  6. String [] s;
  7. public void setS(String[] c){
  8. s = c;
  9. }
  10. public String getit(String z){
  11. List<String> list = new ArrayList<String>(Arrays.asList(s));
  12. String result = "Мимо";
  13. if(list.contains(z)){
  14.  
  15. System.out.println("Попал");
  16. list.remove(z);
  17.  
  18.  
  19. }else if(list.isEmpty()){
  20. result = "Потопил!";
  21. }else{
  22. System.out.println(result);
  23. }
  24.  
  25. return result;
  26.  
  27.  
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement