Purpose of "class" keyword
Java is an Object Oriented Programming System, every Object is to represent a
Real-world Entity i.e (Book, Fan, Person, Product ), Real World Entities having properties for
example "Book" is a Real World Entity can contain properties like "Book Title","Author Name", "Publisher Name","price" e.t.c, if we want to represent this Real World Entity in java we use a special "keyword" called "class" every property represents a type like (integer, String , character, float or it can be any reference types )
BookTitle,, AuthorName, PublisherName is simple String
and the price is of float
which accepts decimal values.
ex :
class Book{
String bookTitle;Real-world Entity i.e (Book, Fan, Person, Product ), Real World Entities having properties for
example "Book" is a Real World Entity can contain properties like "Book Title","Author Name", "Publisher Name","price" e.t.c, if we want to represent this Real World Entity in java we use a special "keyword" called "class" every property represents a type like (integer, String , character, float or it can be any reference types )
BookTitle,, AuthorName, PublisherName is simple String
and the price is of float
which accepts decimal values.
ex :
class Book{
String authorName;
String publisherName,
float price;
}
above example represents a real world entity Book and having its properties
Comments
Post a Comment