GPWiki.org
GPWiki.org
It is currently Tue Jun 18, 2013 7:18 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Variable problem
PostPosted: Tue Nov 29, 2011 10:58 pm 
So i am reading a book called head first java and in chapter 3 he talks about variables i dont exactly know what bytes and chars are like what type are they do they make a decimal is byte simalar to byte code please help :(


Top
  
 
 Post subject: Re: Variable problem
PostPosted: Tue Nov 29, 2011 10:59 pm 
Rookie

Joined: Tue Nov 29, 2011 10:54 pm
Posts: 1
btw im actually swl so yeah im who posted this


Top
 Profile  
 
 Post subject: Re: Variable problem
PostPosted: Wed Nov 30, 2011 1:43 am 
Super-dooper pooper scooper
User avatar

Joined: Tue Oct 11, 2011 8:08 pm
Posts: 170
I don't know exactly if Java variables are the same as c# variables, but I'll assume they are. Bytes are the smallest number type, which can store a integer (non decimal) value between 0 and 255. Chars just hold a single character, like:

'a', or '#', or 'G', etc.
I'm not sure you refer to as 'byte' code.

Hope this helps. ;)


Top
 Profile  
 
 Post subject: Re: Variable problem
PostPosted: Thu Dec 01, 2011 6:38 pm 
Bytewise

Joined: Sun Oct 16, 2011 3:09 pm
Posts: 282
Location: Here (where else?)
Variables are just boxes to store a value in (this works nicely with 'simple' data like integers. For objects, it gets a bit more complicated). You have variables (boxes) of different sizes, see http://java.sun.com/docs/books/jls/seco ... s.doc.html section 4.2.1. A byte-sized variable can store values -128 to 127, etc.
This is especially important if you have not so much room (eg in an embedded device), or if you have storage requirements eg in a file.

In general, you should not care very deeply about the sizes, and just use 'int' for everything, unless -2147483648 to 2147483647 is not large enough :)

Byte code is something different entirely. It is Java program code, translated for your computer (JVM (Java Virtual Machine), to be precise), so it can run the program. Not something you should care much about when still learning about variables.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group