Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
Class Loading and Variable Conversion in Java

CLASSPATH and how it works "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 directives in the code, it will also look in the specified subdirectory offset from each member of the classpath. So in this example, there are three places to look on the CLASSPATH (two directory structures and a .jar file) and for each of them it will look in the specified place, and also at two other places which are imported within them - making a possible 9 locations where it might find the Bicycle class.


Conversion and Coercion You can always get the contents of a pint bottle into a litre bottle, but only SOMETIMES can you get the contents of a litre bottle into a pint one (those some times being if the litre bottle is only half full or less!).

It's the same with variables ... a float can always go into an integer, but an integer may loose something if it goes into a float.

Java automatically does conversions where it's certain that nothing will be lost (coercion), but if something might be lost, it makes the programmer say "yes, I AM sure" by using a cast.

(written 2009-05-02)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A502 - Web Application Deployment - Java - Basic Tools
  [3819] Packing a tar, jar or war file - best practise - (2012-07-26)
  [3151] Disassembling Python and Java - previously compiled code - (2011-01-29)
  [2859] Using java, javac, jar, and CLASSPATH - a simple example - (2010-07-07)
  [2422] Looking inside Java classes - javap and javadoc - (2009-09-25)
  [1909] javax.servlet cannot be resolved - how to solve - (2008-11-26)
  [1771] More HowTo diagrams - MySQL, Tomcat and Java - (2008-08-24)
  [1562] Java Compiler - needs all classes, compiles them all too - (2008-03-03)
  [1192] What are WEB-INF and META-INF directories? - (2007-05-18)
  [1082] Straight from the .jar - (2007-02-16)
  [754] tar, jar, war, ear, sar files - (2006-06-10)

A503 - Web Application Deployment - Java - Sourcing, Installing, Initial Testing
  [2184] Choosing the right version of Java and Tomcat - (2009-05-16)
  [2080] Using ApacheBench and jconsole to test and monitor Tomcat - (2009-03-14)
  [2079] Java - Memory Allocation and garbage collection - (2009-03-14)
  [1908] Java CLASSPATH explained - (2008-11-26)

J703 - Java - Variables
  [3917] BODMAS - the order a computer evaluates arithmetic expressions - (2012-11-09)
  [3365] Turning bright delegates into bright and knowledgable ones - (2011-07-21)
  [3278] Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java. - (2011-05-05)
  [3041] Java - basic rules for arithmetic, variables and conversion - (2010-11-10)
  [3038] Setting up individual variables, and arrays, in Java - some commented examples - (2010-11-09)
  [2148] Variable scope in Java Servlets and other web applications - (2009-05-01)
  [1448] Question on division (Java) - Also Perl, PHP, Python ... - (2007-11-28)
  [127] Conversion and coercion in Java - (2004-11-22)


Back to
My four feet!
Previous and next
or
Horse's mouth home
Forward to
Bean Classes in Java and Java Database Connections
Some other Articles
From the 51773 family
Stopping forum spam - control of the signup process
No subject or title?
Bean Classes in Java and Java Database Connections
Class Loading and Variable Conversion in Java
My four feet!
What is a JSP tag library?
Routers, Firewalls and multilayer servers
Routing Network Traffic - Proxies, Redirects and DNS
4300 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

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

PAGE: http://www.wellho.net/mouth/2153_Cla ... -Java.html • PAGE BUILT: Thu Sep 18 15:30:25 2014 • BUILD SYSTEM: WomanWithCat