What you need to know about Java Beginner (hope to be helpful to beginners)

Source: Internet
Author: User
Tags modifier modifiers terminates

1Installing jdk=> (1, download JDK, install, general directory for C : \program Files\java2, test whether the JDK is installed by the DOS command java–versioncommand to view the installation JDK version; 3. Change the environment variable (1, set the variable name: Java_home.Set the value of the variable to D : jdk6.0;New path, set the value of the variable to %java_home%bin; Class_path,Variable value is .; C:\Program Files\java\jdk1.6.0_43\lib\dt.jar; ); 4, shown by Javac command;)

2 java Basic syntax = 1, identifier . (cannot die keywords; can contain letters, numbers, underscores _ or $; The first must be a letter, _ or $; the name of the camel, not the length of the letter); Hump naming method: Uppercase, cannot start with a number; Pascal nomenclature: lowercase letters, uppercase words; data type (Basic type: integral type (Byte,short,int,long); Floating-point type (float,double); character: (char); Boolean: (Bolean: For JDK Decision (TRUE,FALSE)); Reference type: (Class); interface (lnterface); array); variable : Used to store data. (Name the variable, indicating the type of data stored in the variable.) );

3 Program Flow control = = Boolean operator (&&; | | or; | or (a comparison);! Non-, XOR, or ^);  Select operator : If;if/else;switch (Case,default); Loop statement: While;for (;;);      Do/while;   Jump Statement : Break: Can be used for any loop control structure, so that the loop terminates immediately. Continue: terminates one cycle;

Class 4 , objects and packages the properties (public class Employee{public String name;}   );  Instantiate the object, new creates the object in the operator and returns, adds a member variable to the class, adds a method, accesses the object's properties and methods: Employee E=new employee ();   E.name= "Zhang San"; This reference: current = referenced;

5Behavior of objects = =method Call Stack method Signature: public static void Main (String args [])access Modifiers(Public private,protected or default access modifier); optional modifier (static;final;   abstract;native);   return value (type); formal parameter list; public float divide (int x,float f); Formal parameters and actual parameters (formal parameter lists are used to declare the type of data passed to the method.) The data passed to the formal parameter becomes the actual parameter); 5.5Call by ValueWhen the actual parameter is passed to the formal parameter, the data of the actual parameter is copied to the formal parameter. In programming, the process of copying data between method invocations; 5.6Method Overloading(Advantages: Easy to develop simplified operation, avoid cumbersome) when a class has two or more names with the same name but has different parameter lists, the method is overloaded; Constructors: (The object is initialized on the creation of the object.) ) 1, the constructor name must be the same as the class name, 2, the constructor has no return value (return value type), 3, by default, the class has a parameterless construction method (such as: public students () {}), 4, when the parameter constructor is written out, the system no longer has no parameter constructor; 5, Constructor calls the constructor with this;

6 Arrays = 6.1

Array Summary : int [] sums (  int [] sums= new int[5]{1,2,3,4,5};); 6.3 Array Length: array name .length ;    ; 6.6  Array Copy (system.arraycopy (new array, 0 (starting from 0), copied array, 4, new array. length));   

7          inheritance    public class Child extends extends parent {};   use "is a" Relational judgment Inheritance (' is a ' is a simple and powerful rule to determine if the inheritance of the parent class and subclass is correct, and when using inheritance, you must be able to say the subclass "is a" parent class);      7.5       single and multiple inheritance (inherited single-root, transitive): Java classes can have only one parent class;   7.6  The root class of all classes object (superclass)    (the Java language API contains a special class named Object, which is the root class in the hierarchy of the entire Java class.) The object class, in the Java.lang package, is the parent of every Java class, either a direct parent or an indirect parent class.     7.7 Method Overrides (1. The type of the return value of the method of the subclass, the method name and the formal argument list, must be the same as in the parent class.   2, access modifier Fu Bixun is not less than the access modifier in the parent class.   3, exceptions overridden in subclasses cannot throw more exceptions than parent classes. ) 7.7.1  equals () (determines whether two strings are the same);   7.8  Super keyword (super (attribute,); must be the first statement) Super. Method or Property;   7.9  Final keyword (cannot be inherited using final; The final method cannot be overridden (no subclasses));

8    Advanced concepts of the        class =>  8.1   access Modifier (Public access level: Members that use the Public keyword adornment are exposed externally, that is, public members can be accessed by any other object). Protected Access level: (using the protected keyword modifier, you can be accessed by a class in the same package, and can be accessed by subclasses of the class, regardless of which package the subclass is in).    Default Access Level: (no access modifier.) can be accessed by a class in the same package);   private access level: (using the private keyword modifier, which is the lowest level in the four access modifiers, private members only the class itself can access, not publicly);        8.2  Encapsulation (encapsulation is the technique of making member variables in a class private and providing the public method access to those member variables.) Use Getter (read) setter (write); 8. 3 understand static members (keyword static), static methods cannot access instance members, 8.4 static non-static runs before construction methods (run Order: static => Parent class => non-static => subclass); 8.6 Inner class (1. Static inner Class 2, member inner Class 3, local inner class 4, anonymous inner class);

9 polymorphic and abstract => 9. 1 polymorphic (static polymorphism (such as method overloading): When the program is compiled, the system can decide which method to call, dynamic polymorphism: In the running system can dynamically determine the object referred to by the method, so also become a compile-time polymorphic); 9.1.1 polymorphic Technical basis (1, upward transformation technology; 2, The instanceof keyword is used to determine the true type of object at run time; 3, dynamic binding technology); "1, write the parent class, write the subclass, 2, subclass the parent class method, 3, after the parent class data type to draw the subclass object, automatically find-" polymorphism is the same method name of many different implementations; 9.2 Abstraction abstract (abstract)class a{public abstract void F ();}

The features of the interface => Java interface are summarized as follows:

1, the member variables in the Java interface are public,static,final type (all can be omitted), must be displayed initialization, that is, the member variable in the interface is constant (uppercase, the words are separated by "_")

2, the methods in the Java interface are all public,abstract type (can be omitted), there is no method body, cannot be instantiated

Interface Keyword: parent class: Public interface a{} subclass: The Java interface must implement its abstract method through a class

public class A implements b{...}

What you need to know about Java Beginner (hope to be helpful to beginners)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.