1. What is a class?
Answer: Classes are objectively existing, abstract, and conceptual things.
2. What is the object of?
Answer: Objects are concrete, practical, and represent a thing. For example: a car is a category, and a bicycle is its object.
Description of classes and objects: Classes are templates of objects, and objects are individuals of classes.
3. Methods for defining classes in Java?
class class name defines humans in Java syntax: public class Person{}4. How to define an object?
1. Object declaration: class name object name;
2. Object creation object name = new class name (); new function: allocate memory space.
It can also be written as: class name object name = new class name();
5. Example: Create an air conditioner and call refrigeration.
//Design an air conditioner package practice; public class Kongtiao { //Air conditioner attribute String name; String pinpai; String pishu; int temperature; //Define the refrigeration behavior void cool() { temperature--; } //Define the heating behavior void hot() { temperature+=7; } //The main function public static void main(String[] args){ Kongtiao kt = new Kongtiao(); kt.name = "Mi De"; kt.pishu = "2 horses"; kt.tempeture = 20; kt.pinpai = "Zhi Gao"; /** kt.cool(); System.out.println("The temperature of the air conditioner is "+kt.tempeture); */ kt.hot(); System.out.println("The temperature of the air conditioner is "+kt.tempeture); }}The above brief analysis of the definitions of classes and objects in Java programming is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.