• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Integer literal

 
Vigneshwari Chandrasekaran
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is
DC717012340001
a valid integer literal?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic