Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CustomMob {
- String name;
- String type;
- String hostility;
- String colour;
- public CustomMob (String name, String type, String colour, String hostility, String location){
- this.name =name;
- this.type =type;
- this.hostility = hostility;
- this.colour=colour;
- }
- public String getName (){
- return name;
- }
- public void changeName(String newName){
- name = newName;
- }
- public static void main(String[] args){
- CustomMob myNewMob = new CustomMob("Bob", "Creeper","green","Dangerous","plains");
- System.out.println("My mobs name is: " +myNewMob.getName());
- Scanner input = new Scanner(System.in);
- System.out.println("Please input the new name you want for your mob");
- String newName = input.next();
- myNewMob.changeName(newName);
- System.out.println("My mobs name is: " +myNewMob.getName());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment