Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyGoldfish {
- private static String fishName;
- public MyGoldfish(String name){
- System.out.println( "My goldfish's name is ");
- fishName = "Russell";
- }
- public static void main(String[] args) {
- MyGoldfish myGoldfish = new MyGoldfish( fishName);
- System.out.println(myGoldfish.getName());
- }
- private String getName() {
- return fishName;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement