• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java class  RSS feed

 
lahiru nanayakkara
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i heard that java class works as template and also a data type . is this correct or wrong?
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what you mean by "template" and "data type".
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lahiru nanayakkara wrote:i heard that java class works as template and also a data type . is this correct or wrong?

It's correct, but it's important to understand what it means.

A class is a template for creating objects. A class specifies what objects that you create from the class will look like (what data the objects will contain and what operations are possible on the objects).

A class is also a data type.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!