Primitive Data Types as Parameters
| byte | short | int | long |
| float | double | char | boolean |
The eight primitive data types are given in the table.
The word "primitive" means "a fundamental
piece that is used to create other, larger parts."
So far we have been using parameters with primitive data types.
Here is a tiny program that reviews this:
class SimpleClass
{
public void print( int x )
{
System.out.println("Value of the parameter: " + x );
}
}
class SimpleTester
{
public static void main ( String[] args )
{
int var = 7;
SimpleClass simple = new SimpleClass();
System.out.println("First value of the local var: " + var );
simple.print( var );
System.out.println("Second value of the local var: " + var );
}
}
|
|