File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes what does this command mean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what does this command mean" Watch "what does this command mean" New topic
Author

what does this command mean

sriveena nori
Greenhorn

Joined: Jul 22, 2008
Posts: 1
char ch=(char)-1;
why should we subtract 1from char and assing it to char
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42273
    
  64
Welcoem to JavaRanch.

There's no subtraction here. The number "-1" is cast to a "char" - which is a Java data type. The cast is necessary because generally an integer number can't be assigned to a char. The interesting question is which character is being assigned here; can you guess which one it is, or which character code it has?


Ping & DNS - my free Android networking tools app
Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
You are converting the int -1 to char


[edit]to slow...[/edit]
[ July 22, 2008: Message edited by: Manuel Leiria ]

Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what does this command mean