Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Java module J703
Variables
Exercises, examples and other material relating to training module J703. This topic is presented on public courses Learning to Program in Java, Java Bootcamp, Java Programming for the Web

Information that's produced by one Java statement and used in later ones is held in variables. In Java, variables must be declared before they are used, and you must specify the type of information they contain. Operations can be performed on variables, and casting can be used to convert information of one type to another.


Articles and tips on this subjectupdated
4345Incrementing a variable in Java - Pre and Post Increment
Java (and C, Perl and PHP) supports the ++ operator to increment a variable - in other word, do add 1 to the value it holds and save the reult back in the same place. You can write   counter++; or   ++counter; and as statemnets on their own, they'll do the same thing. However, ...
2014-12-09
 
4324Learning to program - variables and constants
Further material from our "learning to program in ...." courses ... an introduction to variables and constants variable basics Information - data - needs to be stored in a program between statements. Or rather it needs to be stored in the computer's memory. At the lowest of levels, that's a binary ...
2014-11-22
 
3917BODMAS - the order a computer evaluates arithmetic expressions
What order does a computer program use to evaluate expressions? If I write   2 + 3 * 4 + 5 does it start off, left to right ...   2 + 3 is 5   5 * 4 is 20   20 + 5 is 25 No! it does not, even though the newcomer might think that was the most natural way for ...
2012-11-10
 
3365Turning bright delegates into bright and knowledgable ones
"Bright" does not mean "Knowledgable". Almost without exception, our delegates are bright or very bright. But, by definition, they arrive with us for a training course with a lack of knowlegde. And it's a real joy to be able to pass on that knowledge to them - empowering them so that they leave knowledgable, ...
2011-07-21
 
3278Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java.
Starting with a clean slate. Are variables initisialised, and if so, how? Even with this fundamental question, languages vary considerably. C and C++ From my (e)mailbag ... """In a piece of code we’ve written we declare an array, but we do not fill the elements with values, we assume (dangerous ...
2011-05-05
 
3041Java - basic rules for arithmetic, variables and conversion
Declare - Initialise - use - the sequence for Java variables • All Java variables must be declared before they are initialised • All Java variables must be initialised to a value before their current value is used So: 1. Declare (i.e. define the type of variable and the name 2. Set an initial ...
2010-11-10
 
3038Setting up individual variables, and arrays, in Java - some commented examples
In Java, variables must be defined before they have an initial value assigned to them, and they must have an initial value assigned to them before the value thay contain is used; there's no automatic assumption that a new name is a variable, nor is there an assumption made of what type of data a variable ...
2010-11-09
 
2153Class Loading and Variable Conversion in Java
"Where did you get THAT from?" Ever heard that question? I've asked it of Java sometimes, in wondering where a Java virtual machine has found a class from ... and it's not always obvious. When loading a class, Java looks at each location given in the CLASSPATH in turn ... and if there are import ...
2009-05-02
 
1448Question on division (Java) - Also Perl, PHP, Python ...
Q: What's the difference between % and /? A: / returns the result of a division % returns the remainder when you do a division. Divide 18 by 7 you get 2, with a remainder of 4 (i.e. 4 left over). so 18/7 give 2, and 18%7 gives 4. And from Tcl/Tk and Expect... you can see the float v integer considerations ...
2008-09-15
(short)
127Conversion and coercion in Java
The accuracy and conversion of primitive arithmetic variables in Java is something that I'm questioned on regularly. Ideally in Java, you'll perform arithmetic on two pieces of data of an identical type, and the result returned will be of the same type. However, if you perform a calculation on two different ...
2006-06-05
 
Examples from our training material
Add2.java   Adding and declaring variables in a single statement
Addup.java   Simple use of variables - adding
Av2.java   Average - fails at compile
Av3.java   Average - *this* one works
Av3b.java   An alternative working example
Average.java   Averages - how NOT to (try to) do it
Bnd.java   Setting up variables, reading values, calculating and output
Cost.java   Reading a cost from the user
Plus.java   Pre and Post increment in Java
Somevars.java   Declaration and initialisation of variables
WellHouseInput.java   Easy user interaction class
Pictures
On site training in Oxford
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
First use of variables in Java.
Variable names.
Declaring and initialising variables.
Primitive types.
Type casting and conversion.
Reading input from the user.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Java,Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/J703.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb