permaculture playing cards*
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: 3169
    
  10
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: 169
    
    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: 3169
    
  10
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integer literal
 
Similar Threads
Conversion
boxing method call doubt
Character (primitive type)
converting from timestamp to date
java quiz