Advertisement
RazorBlade57

FirstandLast

Oct 28th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. //Β© A+ Computer Science  -  www.apluscompsci.com
  2. //Name -
  3. //Date -
  4. //Class -
  5. //Lab  -
  6.  
  7. import static java.lang.System.*;
  8.  
  9. public class FirstAndLast
  10. {
  11.     private String word;
  12.  
  13.     public FirstAndLast(String s)
  14.     {
  15.         word = "null";
  16.     }
  17.  
  18.     public void setString(String s)
  19.     {
  20.         word = word.substring(0);
  21.     }
  22.  
  23.     public String getFirst()
  24.     {
  25.         word = word.substring(0);
  26.         return word;
  27.     }
  28.    
  29.     public String getLast()
  30.     {
  31.         word = word.substring(5);
  32.         return word;
  33.     }
  34.  
  35.     public String toString()
  36.     {
  37.         String output= word;
  38.         return output;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement