• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preparing for the SCJA

 
Tuesday Ganal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I'm preparing for SCJA and I saw this exam topic about Concrete Classes. What is a concrete class. I can't seem to find it in the Java documentation, and even in my Java complete curriculum. Anybody can help me in finding a site where I can get info on concrete classes? Thanks so much.
 
Triguna Mutuguppe Sripathi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.brpreiss.com/books/opus5/html/page610.html

Hope this helps.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really, a concrete class is one that is not abstract. If you can create an instance of a class by invoking its contstructor, it's concrete!
 
Mala Gupta
Author
Ranch Hand
Pie
Posts: 355
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is an example of a concrete class:


You can create instances of this class as follows:



However, if you prefix the definition of class Person with the keyword abstract, it will then be termed as an abstract class, as follows:



Now, the following code will not compile:



The compiler will complaint that it cannot create objects of an abstract class. An abstract class, as its name suggests, is an incomplete representation of a concept. Hence, creation of its objects isn't allowed.

cheers
Mala
 
Tuesday Ganal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron Wallace McKenzie wrote:Really, a concrete class is one that is not abstract. If you can create an instance of a class by invoking its contstructor, it's concrete!


Thanks, Cameron. BTW, I'm reading your book SCJA Certification Guide.
 
Tuesday Ganal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Triguna Mutuguppe Sripathi wrote:http://www.brpreiss.com/books/opus5/html/page610.html

Hope this helps.



Thanks, Triguna
 
Tuesday Ganal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mala Gupta wrote:The following is an example of a concrete class:


You can create instances of this class as follows:



However, if you prefix the definition of class Person with the keyword abstract, it will then be termed as an abstract class, as follows:



Now, the following code will not compile:



The compiler will complaint that it cannot create objects of an abstract class. An abstract class, as its name suggests, is an incomplete representation of a concept. Hence, creation of its objects isn't allowed.

cheers
Mala



Thanks, Mala for differetiating an abstract from a concrete class. It helps
 
Mala Gupta
Author
Ranch Hand
Pie
Posts: 355
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am glad, it does. A simple example is much more effective than reading 2 pages of theory.

cheers
Mala
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic