Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Java Help

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-22-2006, 04:17 PM
Sionofdarkness Sionofdarkness is offline
Programming Expert
 
Join Date: Jul 2006
Posts: 384
Rep Power: 11
Sionofdarkness is on a distinguished road
Default Variables

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-22-2006, 06:25 PM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Rep Power: 12
dirkfirst is on a distinguished road
Default

Floating point is a decimal like 0.05

Code:
float dec = 0.05;
There are several others
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-29-2006, 01:34 PM
Sionofdarkness Sionofdarkness is offline
Programming Expert
 
Join Date: Jul 2006
Posts: 384
Rep Power: 11
Sionofdarkness is on a distinguished road
Default

I see. I can see how there would have to be different variables to represent letters and numbers, but why do they have to make a variable dedicated to decimals?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-29-2006, 03:34 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,398
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-21-2006, 03:32 PM
Sionofdarkness Sionofdarkness is offline
Programming Expert
 
Join Date: Jul 2006
Posts: 384
Rep Power: 11
Sionofdarkness is on a distinguished road
Default

That explains it. I thought all those different variable types were there for... I don't know what, but I didn't see a point. Now I do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT -5. The time now is 03:04 AM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads