Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Airplane.java:
- public class Airplane {
- private String name;
- public Airplane(String name) {
- this.name = name;
- printName();
- }
- private void printName() {
- System.out.println("Name: " + name);
- }
- }
- ObjectTest.java:
- public class ObjectTest {
- public static void main(String[] args) {
- Airplane Gripen = new Airplane("Saab-39 Gripen");
- Airplane Viggen = new Airplane("Saab-37 Viggen");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement