This week began to really learn Java and C language different places, began to understand classes, objects, packages, static methods and other knowledge. Through this week's study also let me discover own many shortcomings, in the future study also will go to correct.
In Java, classes are divided into custom classes and two of standard classes, and custom classes are defined by the user itself. The instance domain and the instance domain method are included in the class, first defining the private instance domain, receiving the instance domain by defining the constructor, the constructor has the same name as the class, and the constructor has no return value, and the constructor is called through the execution of the new operator. The action to be made on the instance domain is designed by establishing (public+ Type + action method name () {}). Typically, the method name prefix for access to the instance domain is get, and the method name prefix for the instance domain modification is set. In the main () function, this object can access all the methods in the class by defining an object of its own type. In the same package, the different classes defined in each program can be called between each program. You cannot have two classes of the same class name in the same package. A static method is a method that cannot manipulate an object, but it can operate on a static instance domain in the same class. Access-time class name. + static method name. A static domain belongs to a class that does not belong to any independent object. This is the property reference and this () is the constructor reference.
In the process of writing a program for a better understanding of the fuzzy knowledge, will also use the user-defined class. Common errors were found. To the class, object this piece has its own understanding.
Print (), the difference between printf,println:
Print is the general standard input, output, no line break. Line break (for example: print (n+ "\ n") by newline character;
printf is mainly inherited the C language of printf some characteristics, can be formatted output;
println and print are not much different, but the println will wrap automatically after the output.
Value of will convert the base data type to a string type.
string.valueof (char c): Converts a char variable C to a string.
String.valueof (char[] data,int offset,int count): Converts the char array data from Data[offset] to count elements to a string
201671010114 2016-2017-2 "Java Programming" fourth Chapter summary