Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Robot {
- String name;
- Robot (String name) {
- this.name = name;
- }
- void speak (String msg) {
- System.out.println(msg + name);
- }
- public static void main (String[] args) {
- Robot r = new Robot("debbie");
- r.speak("hey there! It's me... ");
- Robot b = new Robot("bob");
- b.speak("My name is... ");
- }
- }
Add Comment
Please, Sign In to add comment