|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
What exactly do variables do? I know there are many kinds of variables, but how many different kinds are there and what do they do? The only kind of variable I know of is the Floating Point variable, and I have no idea what that does.
|
| Sponsored Links |
|
|
|
|||
|
Floating point is a decimal like 0.05
Code:
float dec = 0.05; int = whole number (1) char = character string = array of characters (or just a string like "hello world") double = larger float Those are all I can think of off the top of my head. Variables store data and make your program work. The easiest example I can think of is a counter: Code:
int counter = 1;
if (counter == 1) {
..... code here
}
__________________
DirkFirst |
|
|||||
|
When you're working with numeric data, there are a few different ways that people want to work with it. If you're dealing with scientific applications, you often will need to deal with very large or small values. As a result, you need to be able to store the basic value, say 1.3572, as well as the exponent on the 10, say -3. Then you have a value: 1.3572E-3 that corresponds to 0.0013572. This requires more information that storing simple integer values. On the other hand, integers have properties that don't make sense for decimal values, like successor and predecessor (++ and --). Integers also usually require less memory to store. As a result, people tend to use whichever type of number best corresponds to what is being done. Money gets stored in floats, while counters get stored in ints, for example.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Global variables (SERVER) | Jaan | PHP Tutorials | 0 | 03-22-2007 10:43 PM |
| Variables | clookid | PHP Tutorials | 1 | 01-11-2007 09:40 PM |
| Java:Tutorial - The Variable | John | Java Tutorials | 0 | 12-09-2006 10:59 AM |
| Save variables | yoda855 | Visual Basic Programming | 9 | 08-22-2006 08:10 PM |
| Howto use global variables | dirkfirst | PHP Forum | 4 | 07-15-2006 03:19 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |