Save, Compile, Execute
- Sree Hari
- Mar 9, 2017
- 1 min read
Previous Blog: Class Structure and Object Creation
Book.java
public class Book {
private String name;
public Book(String name){
this.name = name;
}
public void whoAmI(){
System.out.println("I am " + name);
}
public static void main(String[] args) {
Book book1 = new Book("Java, The Complete Reference");
Book book2 = new Book("Heads First Java");
book1.whoAmI();
book2.whoAmI();
}
}

.........
Commentaires