wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Literals !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Literals !!!" Watch "Literals !!!" New topic
Author

Literals !!!

Ganesh Kumar
Ranch Hand

Joined: Jul 02, 2007
Posts: 113
Hi friends
Can anyone tell me the meaning of literals?? And also what String,Char literals means???

Thanks
Shoumin Li
Ranch Hand

Joined: Jul 06, 2007
Posts: 85
Literal,in programming, a value written exactly as it's meant to be interpreted.
A character literal is expressed as a character or an escape sequence, enclosed in ASCII single quotes.
A string literal consists of zero or more characters enclosed in double quotes.
[ July 16, 2007: Message edited by: Shoumin Li ]

Java Blog
Ganesh Kumar
Ranch Hand

Joined: Jul 02, 2007
Posts: 113
Sorry li.Can you little more clear.I didnt get you
vanlalhmangaiha khiangte
Ranch Hand

Joined: Sep 11, 2006
Posts: 170
A literal denotes a constant value, that is, the value a literal represents remains unchanged in the program. Literals represent numerical (integer or floating-point), character, boolean or string values. In addition, there is the literal null that represents the null reference.

Example

Integer
2000 0 -7

Floating-point
3.14 -3.14 .5 0.5

Character
'a' 'A' '0' ':' '-' ')'

Boolean
true false

String
"abba" "3.14" "for" "a piece of the action"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Literals !!!
 
Similar Threads
the "+" operator
what does "true" belong to?
Garbage
instanceof question
reserved words