/** * This class illustrates the 8 basic primitive types in Java * * @author alchambers * @version sp17 */ public class PrimitiveTypes { public static void main(String[] args){ // Declaring variables of primitive type byte age = 20; short salary = 30000; int circleWidth = 200; long population = 7000000000L; // note the L at the end float size = 40.2F; // note the F at the end double radius = 50.11112; char letterGrade = 'A'; boolean gameOver = false; System.out.println("Your age is " + age); System.out.println("Your salary is " + salary); System.out.println("The circle's width is " + circleWidth); System.out.println("The world's population is " + population); System.out.println("The size is " + size); System.out.println("The radius is " + radius); System.out.println("Your letter grade is " + letterGrade); System.out.println("Is the game over? " + gameOver); // Assigning new values to the variables age = 110; salary = 31000; circleWidth = 100; population = 7000000001L; // note the L at the end size = -40.2F; // note the F at the end radius = 30.33333; letterGrade = 'B'; gameOver = true; System.out.println(); System.out.println("Your age is now " + age); System.out.println("Your salary is now " + salary); System.out.println("The circle's width is now " + circleWidth); System.out.println("The world's population is now " + population); System.out.println("The size is now " + size); System.out.println("The radius is now " + radius); System.out.println("Your letter grade is now " + letterGrade); System.out.println("Is the game over now? " + gameOver); } }