• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

is Date a datatype ????

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
i have a small query ,whether we can consider date as a datatype or not ... well i know it is not consider as datatype by SUN but as we consider String as a Datatype which is also a class then why not Date ? ..
can anyone can share his/her knowledge on this ..

-----
Diwakar
SCJP 1.4
 
Ranch Hand
Posts: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think String is a data type. It is a class built to handle multi-character sequences aka strings.
String str = "abc"; is equivalent to:
char data[] = {'a', 'b', 'c'};
String str = new String(data);
Similarly Date class is used to represent specific instance of time.
Well, data types are basic building blocks of data. Think them as atoms of Chemistry. You can't lessen them further.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Classes and interfaces are often referred to as "types".

Why do you think Sun doesn't consider Date a "data type"? It sounds like Faisal actually means "primitive type".

What do you mean with "data type"? Did you really mean "primitive type"?

Primitive types in Java are the non-object types: boolean, byte, short, int, long, char, float, double.

Types such as Date and String are not primitive types.
[ September 13, 2007: Message edited by: Jesper Young ]
 
Faisal Ahmad
Ranch Hand
Posts: 358
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jesper,
I agree with you. But I have a question. Objects hold data in terms of primitive data types, yeah? I think therz subtle difference between 'data type' and 'type'. I don't think they are one and same. A 'type' might refer to which inheritance tree an object belongs to. A 'data type' has nothing to do with this. It purely refers to the data - the bits involved.
If I am wrong or perhaps ignored something, please do correct me. Thanks in advance!
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there are two data types, primitive data type and all the others are just data type
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Faisal, I've never heard of that distinction between "type" and "data type" and I don't think it's an official or commonly accepted definition of the terms.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Jesper. Perhaps some people somewhere have a specific definition of "data type", but for the SCJP exam the term is not used. You need to know the difference between primitive types and reference types, certainly, but nothing about "data types" that are somehow different than other types.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah Thats the thing. Only two types "Primitive Type" and "Reference Type" for JAVA.
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic