This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Integer literal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Integer literal" Watch "Integer literal" New topic
Author

Integer literal

Vigneshwari Chandrasekaran
Greenhorn

Joined: Jan 04, 2013
Posts: 16
Is
DC717012340001
a valid integer literal?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3603
    
  15
The easiest way to answer that is to write a simple program that assigns that value to an int variable and see if you get a compiler error


Joanne
Ramesh Pramuditha Rathnayake
Ranch Hand

Joined: Oct 31, 2012
Posts: 172
    
    1

Yes..!
It is a java literal for String.. But you have to write the value inside "" marks..


But there are no Data Type to store that literal..


Ramesh-X
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3603
    
  15
Ramesh Pramuditha Rathnayake wrote:Yes..!
It is a java literal for String.. But you have to write the value inside "" marks..


But there are no Data Type to store that literal..

Yes there is. DC717012340001 is a valid hexadecimal value. (assuming it's prefixed with '0x' in the Java code).
The OP just needs to work out whether it is a valid int value and if not whether there is a larger primitive type that can hold that value.
 
Consider Paul's rocket mass heater.
 
subject: Integer literal