Results 1 to 6 of 6
Thread: type converison
- 04-04-2012, 09:27 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
- 04-04-2012, 09:34 PM #2
Re: type converison
Recommended reading: Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
"Values of the integral types byte, short, int, and long can be created from int literals."How to Ask Questions the Smart Way
Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
Static Void Games forum - Come say hello!
- 04-04-2012, 09:38 PM #3
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
Re: type converison
but character is not an integral type..
still we can write
char ch=66;
- 04-04-2012, 09:58 PM #4
Re: type converison
Same principle applies. I'm really not sure what your question is? The fact is that we can do it this way. Asking why is a bit moot.
How to Ask Questions the Smart Way
Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
Static Void Games forum - Come say hello!
- 04-04-2012, 10:04 PM #5
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
Re: type converison
See , what I am trying to ask is that....
66 is by default integer...
if we assign an integer to char, its loss of precision..
wat u told that byte, short initial values can be created from int literals..fyn..but..is the same applies for char...
- 04-04-2012, 10:41 PM #6
Re: type converison
char is an integral type. See the JLS: Chapter*4.*Types, Values, and Variables
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
Similar Threads
-
Casting Enum Type arrays to object type arrays
By nmvictor in forum Advanced JavaReplies: 4Last Post: 02-17-2012, 01:49 PM -
Trying to convert Java Date to type int to fit in mysql table with field type int(11)
By fortwnty420 in forum New To JavaReplies: 4Last Post: 08-01-2011, 11:29 AM -
Setting values from One Enum type to another enum type.
By reach2sudhakar in forum New To JavaReplies: 3Last Post: 09-23-2010, 07:02 PM -
using instanceof to get Object type and parent type?
By xcallmejudasx in forum New To JavaReplies: 2Last Post: 11-06-2008, 07:24 PM -
[SOLVED] Cast string type to int type
By GilaMonster in forum New To JavaReplies: 9Last Post: 09-17-2008, 11:43 AM
Bookmarks