functions and variables thermostat objectfor examplewould contain not only furnace_on(and furnace_off(functionsbut also currenttemp and desiredtemp incidentallybefore going further we should note that in javafunctions are called methods and variables are called fields this new entitythe objectsolves several problems simultaneously not only does programming object correspond more accurately to objects in the real worldit also solves the problem engendered by global data in the procedural model the furnace_on(and furnace_off(methods can access currenttemp and desiredtemp these variables are hidden from methods that are not part of thermostathoweverso they are less likely to be accidentally changed by rogue method classes you might think that the idea of an object would be enough for one programming revolutionbut there' more early onit was realized that you might want to make several objects of the same type maybe you're writing furnace control program for an entire apartment housefor exampleand you need several dozen thermostat objects in your program it seems shame to go to the trouble of specifying each one separately thusthe idea of classes was born class is specification-- blueprint--for one or more objects here' how thermostat classfor examplemight look in javaclass thermostat private float currenttemp()private float desiredtemp()public void furnace_on(/method body goes here public void furnace_off(/method body goes here /end class thermostat the java keyword class introduces the class specificationfollowed by the name you want to give the classhere it' thermostat enclosed in curly brackets are the fields and methods (variables and functionsthat make up the class we've left out the body of the methodsnormally there would be many lines of program code for each one programmers will recognize this syntax as similar to structurewhile +programmers will notice that it' very much like class in ++except that there' no semicolon at the end (why did we need the semicolon in +anyway?creating objects specifying class doesn' create any objects of that class (in the same way specifying structure in doesn' create any variables to actually create objects in java you must use the keyword new at the same time an object is createdyou need to store