Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. public class MyGoldfish {
  2.     private static String fishName;
  3.     public MyGoldfish(String name){
  4.         System.out.println( "My goldfish's name is ");
  5.         fishName = "Russell";
  6.     }
  7.     public static void main(String[] args) {
  8.         MyGoldfish myGoldfish = new MyGoldfish( fishName);
  9.         System.out.println(myGoldfish.getName());
  10.     }
  11.     private String getName() {
  12.         return fishName;
  13.        
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement