This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 3011
    
    9
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: 100
    
    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: 3011
    
    9
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Integer literal
 
Similar Threads
converting from timestamp to date
boxing method call doubt
Character (primitive type)
Conversion
java quiz