1. Computing
Send to a Friend via Email

Class

By

Definition:

A class specifies the design of an object. It states what data an object can hold and the way it can behave when using the data.

Examples:

You could tell someone about a book by writing it's details down on a piece of paper (e.g., title, author, publisher, etc..). The same is true if you write a class to define a book object:

public class Book {
 
    private String title;
    private String author;
    private String publisher;
 
    public Book(String bookTitle, String authorName, String publisherName)
    {
      title = bookTitle;
      author = authorName;
      publisher = publisherName;
    }

}

An instance of this class will be a book object:

Book firstBook = new Book("Horton Hears A Who!","Dr. Seuss","Random House");

Glossary:

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

  1. About.com
  2. Computing
  3. Java
  4. Java Glossary
  5. C
  6. Definition for the Java Term: Class

©2014 About.com. All rights reserved.