This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Basic Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Basic Question" Watch "Basic Question" New topic

Basic Question

ramap prabhas
Ranch Hand

Joined: Feb 17, 2004
Posts: 54
Is there any difference between floating point literal and primitive floating point(primitive and literal)
Thanks in Advance,
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

A 'literal' is a value that actually appears in the source code; a character literal looks like 'a', a String literal like "Hello", and a floating-point literal like 123.23 . The word "primitive" refers to a datatype that's not an object; there are only a few primitive types in Java (byte, char, short, int, long, float, and double.)
So the question of what's the difference isn't really a meaningful one. All floats and doubles are primitives; a literal float or double can appear in your source code.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Basic Question
It's not a secret anymore!