parameter is different. (8) Method overload case comparison of multiple methods with the same name for different types.method invocation Plot:2: Array (master)(1) array: A container that stores multiple elements of the same data type. (2) Features: Each element has a number, starting from 0, the maximum number is the length-1. Number of professional names: Index (3) define format A: data type [] array name; B: Data type array name []; Recommendation
preserved all [because the arrays use memory, so the modifications are preserved].************************************Modify the array, and the array changes are savedpublic static void Updatearr (int[] array) {array[0]=12;}public static void Main (string[] args) {Int[] Array = {n/a};Updatearr (array);System.out.println (Array[0]);}************************************Note: In addition to being able to receive arrays, the method can return an array by method, simply by returning an array on the
interface name () {override method; } D: Essence:is actually a subclass of anonymous objects that inherit the class or implement an interface(8)The use of anonymous internal classes in developmentWhen we develop, we see abstract classes, or interfaces as parameters. And this time, we know that what is actually needed is a subclass object.If the method is called only once, we can use the format of the anonymous inner class to simplify. (First of all,
inheritanceobject changes in polymorphic memory plots(8) polymorphic exercises A: Cat and dog case B: teacher and student case3: Abstract class (Master)Abstract class overviewLooking back at our cat and dog case earlier, we extracted an animal class. And we've created animal objects in front of us, but that's not true. Why? Because, I say animals, do you know what kind of animal I'm talking about? Only when you see the specific animal, do you know
positive and negative signs of the bit, in the lowest bit will be with the actual data error, in simple terms, we give the value, in In most cases it takes more than 64bit of digits to be accurately represented (even in the case of an infinite number of bits), whereas a double type has a value of only 64bit, and the number of digits behind it will definitely bring an error, and the result of "mathematically accurate" cannot be obtained.8,A: When usin
things C: Classes member variables things properties Member methods thing behavior D: class: Is a set of related properties and behaviors. is an abstract concept. object: is the concrete existence of this kind of thing, is a concrete example. (object) Example: Student: Class Squad Leader: Object (5) class definition and use A: class definition member variable The definition format is the same as before, where the location is different, in the class, outside the method. Membe
is Wed"; - the Break; + Case4: ADay= "Today is Thu"; the + Break; - Case5: $Day= "Today is Fri"; $ Break; - Case6: -Day= "Today is the SAT"; the Break; - Case7: WuyiDay= "Today is Sun"; the Break; - Wu } -
(Chapter II) > Package (without access modifier) > private8. About overloading8.1 must be in the same class, the method name is the same, the argument list is different (the number of method parameters or the parameter type is different), and the method return value and method modifiers have no relationship8.2 Overloaded matching method rules are from precise to fuzzy until a suitable method is found PackageOrg.lyrk.accp8.s2.chapter.one;/*** Created by Niechen on 17/4/17.*/ Public classTest8 {
introduces repeated annotations so that the same annotations can be declared multiple times in the same place. The Repeatable annotation is required. Java 8 is optimized at the compiler layer, and the same annotation is saved as a set, so the underlying principle remains unchanged.
5. Support for extended annotations
Java 8
This section explains the operator applicationThe Java calculation is divided into:Arithmetic operatorsOde value operatorlogical operatorsBitwise operatorsMeta operatorHere is a video explanation of the major types of operators, and there are exercises to provide youInterview questions:1. The most efficient way to figure out 2 times 8 equals a few?2. Swap the values of two integer variables (no third-party
This section mainly explains the application of operatorsThe Java operators are divided into:Arithmetic operatorsAssignment operatorslogical operatorsBitwise operatorsTernary operatorsHere is a video to explain the major types of operators, and there are exercises to provide everyoneInterview questions:1. The most efficient way to figure out 2 times 8 equals a few?2. Swap the values of two integer variables
variable: method zone static Zone member variable: heap memory C: Life cycle different static variable: Static variable is loaded with class and disappears with class Member variables: member variables exist as objects are created and disappear as the object disappears D: Call different static variables: You can call by object name, or you can call member variables through the class name: Only the object name is called (6) The main method is static public: Permissions Max static: No Call void w
inherited. (2) The final member variable represents a constant, which can only be assigned once, and the value will no longer change after the assignment. (3) Final cannot be used to modify the construction method.5.2 Final action on the method: If a class does not allow its subclasses to overwrite a method, you can declare this method as the final method. There are two reasons for using the final method: First, lock the method to prevent any inherited classes from modifying it
JAVA course 31st (Common Object API)-StringBuffer Class amp; StringBuilder class
StringBuffer class
The principle of string composition is implemented through this class
StringBuffer can add or delete string content
StringBuffer is a container
Many methods are the same as strings.
I. Features
StringBuffer string buffer, used to store data in containers
1. Variable Length
2. Different data types can be st
1 PackageCom.xunhuan;2 3 Public classZuoYe004 {4 5 Public Static voidMain (string[] args) {6 intMen ;7 intwomen;8 intKids;9 //The number of men is less or equal to 10, on this basis the self-addedTen for(men=0;men){ One for(women=0;women//women are equal to 30 people. A if(30-men-women >= 0) {//If you use 30 total-men-the number of women results is greater than or equal to 0,
() { - +Color= "Blue"; System.out.println ("Sub class non-parametric construction"); - + } A at PublicSub (String c) { - -Color=c; System.out.println ("Sub class has a parameter structure"); - - } - in - PublicSub (Doubles,string c) { to + Super(s);//calling a constructor with a parameter in the base class - theColor=C; * $System.out.println ("Sub class has a parameter structure");Panax Notoginseng
internal masking details, external methods used to invoke, when to complete a function, we do not need to understand how this is implemented, just need to know to call this method to implement this function is goodTo illustrate:1 PackageCh11;2 3 /**4 * Student class, grammatical structure:5 * Public class class name {6 *//Properties7 * 8 * 9 *//MethodTen * } One * Created by Niechen on 17/5/13. A */ - classStudent { - /* the * syntax
1 PackageCom.xunhuan;2 3 Public classZuoYe003 {4 5 6 Public Static voidMain (string[] args) {7 8 for(inti = 1; i//Enter for Loop, (I=1 i9 if(i%3==0i%5==0) {//If judgment I take 3 no remainder, and I take more than 5 no remainder into if, the output is a multiple of 3 and 5TenSystem.out.println ("Filpflop"); One}Else if(i%3==0) {//does not satisfy if enter else if,i take-out 3==0, multiples of output 3 ASystem.out.println ("
1 PackageCom.xunhuan;2 3 Public classZUOYE02 {4 5 Public Static voidMain (string[] args) {6 intA = 0;7 intb = 1 ;8 Do {9 if(b%7==0) {//First Judge B is not the remainder, if there is no remainder proof is a multiple of 7TenA=a+b;//calculates the number of the other with a multiple of 7 One}b++; A} while(B//B is less than - System.out.println (a); - the } - -}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.