Java basic learning sentiment

xiaoxiao2021-03-06  14

I. How to distinguish between classification variables and instance variables, class methods, and instance methods. 1. Class variables refer to: The value of a member variable of a class of classes in all instances of the class is the same. When the value of the member variable corresponding to any instance changes, the value of the member variable corresponding to all instances becomes a new value. Class variables are named with static. (Sharing data can be achieved) 2, instance variables: Define all other member variables outside the STATIC variable. (Each instance has its own independent instance variable space) 3, class method: a member method of static in front of the class. (In the class, the class method can only be operated) 4, an instance method: Define all methods except the STATIC member method in the class. 5, the difference between class members and instance members: (1) The class member can only operate itself. (2) The class member can be accessed from the class itself. You don't have to instantiate classes to access its class members. Second, the initialization of class members and instance members. 1. The class member is initialized using the STATIC block. Because class members cannot initialize in the constructor. 2. Initialization of instance members perform in the constructor, and instance members can have multiple constructor. (Differences with the number of parameters) Third, the differences between classes and objects. Category can be understood as an abstraction of the characteristics and behavior of a matter in the real world. The object is an example of a specific view of this abstraction. Fourth, the Java running environment setting 1, to the official website of Java www.java.sun.com Download J2SDK1.4.2_07 and install it on the system disk. 2. Setting (key) Environment variable (key) Assume that the program written in C: / Java. If an Exception in Thread "Main" java.lang.noclassdeffounderror: The environment variable is not set correctly. Setting method: For example: put your * .java program under C: / Java, J2SDK1.4.2_07 is installed under C: /J2SDK1.4.2_07, enter C: / Java command: set path = C: / JDK1 .2.2 / bin then runs its own procedure. 3, the general setup method of environment variables: a. If it is Win95 / 98, add the following three-line statement to the last side of /autoexec.bat:

Java_Home = C: /J2SDK1.4.1path=%java_home%/bin;% path% classpath =.;% Java_home% / lib

b. If it is Win2000, use the mouse to right click "My Computer" -> Properties -> Advanced -> Environment Variables

System Variables -> New -> Variable Name: Java_Home Variable: C: /J2SDK1.4.1 System Variable -> New -> Variable Name: ClassPath Variable:.;% Java_Home% / LIB System Variable -> Edit -> Variable Name : Path plus the most in the most in the variable:% java_home% / bin;

转载请注明原文地址:https://www.9cbs.com/read-50437.html

New Post(0)