Programming, website development forum Get latest updates by RSS Follow TechnicalTalk on Twitter Follow TechnicalTalk on Facebook 
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password    
  Forgot your password?  

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Primitive JAVA technology types

 
webmaster forum
vijay12  Offline
Activity
0%
 
Regular Coder
Posts: 67
Topics: 33
January 03, 2009, 11:05:52 AM

hello friends !!!  can  you  describe  the  differences  between  variables  holding  primitive  values  as  compared  with  object  references Huh?? what  are  all  the primitive JAVA technology types Huh?
« Last Edit: January 03, 2009, 12:26:20 PM by Admin »
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
January 03, 2009, 02:53:45 PM

Primitive types are int, char, boolean, float, double - they are built into Java. Whereas all other "types" are objects and built as objects and are more loosely coupled from Java itself. Usually variables holding primitive types will only be holding a single value (not a complex memory allocation as required with some objects.) When you call methods in Java, primitives are passed by value whereas objects are passed by reference.

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
webmaster forum
Activity
0%
 
New Coder
Posts: 41
Topics: 0
WWW
September 23, 2011, 06:56:49 AM

Scope Examples

JavaScript and PHP do not require you to declare a variable before use. This can be handy when you just need to get something done but problematic when troubleshooting.

For example, in JavaScript, a variable declared outside of a function is available inside a function:
Code:
var name = "Jonathan";
function showme()
{
    alert(name); // will display "Jonathan"
}
showme();

A variable declared within a function will not be available outside of a function.

function showme()
{
    var name = "Jonathan";
}
showme();
alert(name); // name will be undefined

Confusion can really begin to set in when using the same variable name inside and outside of a function.

var name = "Jonathan";
function showme()
{
    var name = "Snook";
    alert(name); // will display "Snook"
}
showme();
alert(name); // will display "Jonathan"
Some languages have syntax to prevent these types of errors from occurring. In PHP, for example, to use a global variable inside a function, you must use the global keyword.

Display Banner | Pull Up Banner
 
webmaster forum
polas  Offline
Activity
33.33%
 
Code Guru
Gender: Male
Posts: 1399
Topics: 85
WWW
September 29, 2011, 02:36:01 PM

I fail to see how that has any relevance to the topic?

Mesham Type Oriented Parallel Programming Language, Free online technical support
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.15 | SMF © 2011, Simple Machines


Google visited last this page February 01, 2012, 03:59:50 AM