Java - Programming Language
This course covers the basics of programming in Java. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Classes & Objects (Cont)

Lesson 27
Author : Afrixi
Last Updated : October, 2017


Table of Content

Code

Copyclass Book{
     public String title;
     public String author;
}

public class App{
     public static void main(String [] args){
          Book book1 = new Book();
          book1.title = "Harry Potter";
          book1.author = "JK Rowling";

          System.out.println(book1.title);

          Book book2 = new Book();
          book2.title = "Lord of the Rings";
          book2.author = "JRR Tolkien";

          System.out.println(book2.title);
     }
}