A primitive data type is one of the eight fundamental methods used to represent data that is built into Java.
The eight primitive data types are:
byte | short | int | long | float | double | char | boolean |
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 ); } }
What is the output of the program?