How to learn Java for small white

Source: Internet
Author: User

We learn any kind of programming language, not to go to a non-purpose online to find too many tutorials, but first from the macro understanding of its basic concept of thinking, from the macro sense of its logic and abstraction, and then practice, continuous practice. Today we look at the online to give us a little white some study advice.

First, there are many tutorials, called learning also useless

This year, the online Java tutorial A bunch of, see many of our Java babies are dazzled, do not know how to be good, I was also from this process came, every day to see a lot of teachers of the Java tutorial, listen to their own dizzy, of course, I am not saying that they are wrong, They speak of the knowledge level of things is right, but a lot of Java tutorial teachers are not good at simple, easy to understand to explain knowledge for us, what is a good tutorial? A good tutorial is to let us learn, there is a sense of the enlightened, rather than the clouds do not know where, I would like to say that this tutorial, do not see, waste time, confused themselves.

There is a tutorial called wherever you are, can live to teach you

Now many of the online circulation of the tutorials are many years ago, far from the need to adapt to the new Java applications, are basically some of the elimination of goods, a lot of small partners, from the Internet to find this kind of rags, learn the joy, is also drunk. To sum up, many of us do not learn Java, because the first choice is wrong, the choice is wrong, efforts in vain. In order to enable the vast number of Java students on the internet to learn Java system essence of knowledge, easy to understand the knowledge, we decided to live on the internet every night to teach you to learn Java, our teachers, the general teachers do not, we only let the cow broke the teacher said, and you do not need to pay, You just have to come to our group and listen. The first part of the beginning is: 143., located in the middle of the second part is: 510, in the last part is: 168, learning without any excuse, want to strong will work hard, at the same time this is not a single fight of the times, we are here a piece of learning, to fight the new world of Java belongs to us.

Iii. 30 Basic concepts for beginners in Java

In the process of learning Java, mastering the basic concepts of our study is very important, whether it is J2se,j2ee,j2me, J2SE is the basis of Java, it is necessary to summarize the basic concepts, so that everyone in the future learning process to better understand the essence of Java, I have summed up 30 basic concepts here.

Java Overview:

Currently Java is mainly used in the development of middleware (middleware)---processing client-to-server communication technology, early practice proved that Java is not suitable for the development of PC applications, and its development has gradually become in the development of handheld devices, Internet Information stations, and vehicle computer development. Java differs from other languages in that the program runs with the platform's independence, and commends the ability to use the exact same code on windows,solaris,linux other operating systems. Java syntax is similar to C + + syntax, C++/C programmers are easy to master, and Java is completely object-oriented, which presents a good GC (garbage Collector) garbage disposal mechanism to prevent memory overflow.

Java's white paper gives us 11 key attributes of the Java language

(1), Easy:java syntax is relatively simple than C + +, another aspect is that Java can make software run on a very small machine, the basic interpretation of its and class library support size of about 40KB, increase the basic standard library and thread support memory needs to increase 125kb.

(2), distributed: Java with a very strong TCP/IP protocol Family example libraries, Java applications can pass through the network URL to access remote objects, due to the advent of the servlet mechanism, so that Java programming is very efficient, now many large web The servlet is supported by the server.

(3) Oo: Object-oriented design is a programming technique that focuses on the interface of objects and objects. Its object-oriented and C + + have many differences in the processing with multiple inheritance and the original class model of Java.

(4) Robust trait: Java has adopted a secure pointer model that reduces the potential for rewriting memory and data crashes.

(5), security: Java used to design the network and distribution system, which brings new security issues, Java can be used to build anti-virus and anti-attacks system. Java has proved to be very good at antivirus.

(6), neutral architecture: Java compiles its generation architecture-neutral target file format can be executed on many processors, compiler generated instruction bytecode (Javabytecode) to implement this feature, this bytecode can be interpreted on any machine execution.

(7), portable: Java has strict rules for the size and algorithm of basic data structure types, so portability is good.

(8), multi-threaded: Java process of multithreading is very simple, Java to the implementation of multi-threaded to the following operating system or thread program. So multithreading is one of the popular reasons for Java as a server-side development language.

(9), applets, and Servlets: programs that can be executed on a Web page are called applets and require a lot of Java-enabled browsers, while applets support dynamic Web pages that many other languages cannot.

New Basic concepts:

1, OOP is the only relationship between the object interface is what, like a computer vendor she regardless of the power supply internal structure is what, he only relationship can provide you with electricity on the line, that is, just know can or is not and do and why. All programs are made up of certain attributes and behavior objects, The access of different objects is accomplished by function call, and all communication between objects is through method call, and the reuse rate is greatly improved by the encapsulation object data.

2, the most important idea in OOP is the class, the class is the template is the blueprint, constructs an object from the class, namely creates an instance of this class (instance).

3, encapsulation: is to combine data and behavior in a package, and the object of the user to hide data implementation process, the data in an object called his instance field (instance field).

4, by extending a class to obtain a new class called Inheritance (Inheritance), and all classes are extended by the object root superclass, the root superclass is described below.

5.3 main features of the object

      Behavior---Explain what this object can do.
    State
      ---The object's reflection when the object imposes a method.
      Identity---A distinguishing token from other similar behavior objects.
      Each object has a unique indentity and these 3 are affected by each other.

6, the relationship between the classes:

      use-a: Dependencies
      has-a: Aggregation relationship
      is-a: Inheritance Relationship--Example: Class A inherits Class B, at which point a class has not only the method of Class B, but also its own method. (Personality exists in commonness)

7, constructs the object to use the constructor: the constructor proposes, the constructor is a special method, constructs the object and initializes it.

Example: The constructor of the data class is called data

The new Data ()---Constructs an object and initializes the current time.
Data happyday=new data ()---assigns an object to a variable happyday, so that the object can be used more than once, where the variable to be declared differs from the object variable. The value returned by new is a reference.

      constructor Features: Constructors can have 0, one or more parameters
      constructors and classes have the same name
      A class can have more than one constructor
    The
      constructor has no return value
      constructors are always used with the new operator.

8. Overloading: Overloads occur when multiple methods have the same name and have different parameters. The compiler must pick out which method to call.

9. Package Java allows one or more classes to be collected together into a group, called packages, to facilitate the organization of tasks, the standard Java library is divided into many packages. Java.lang Java.util java,net, Packages are hierarchical and all Java packages are within the Java and Javax package hierarchy.

10, inherit the idea: Allow to build a new class on the basis of existing classes, when you inherit an already existing class, then you reuse the method and field of this class, and you can add new methods and fields in the new class.

11. Extension class: The extension class fully embodies the inheritance relationship of Is-a. The form is: Class (subclass) extends (base class).

12, polymorphic: In Java, the object variable is polymorphic. Multiple inheritance is not supported in Java.

13. Dynamic binding: A mechanism for invoking object methods.

      (1) The compiler checks the type and method name of the object declaration.
      (2) The compiler checks the parameter type of the method call.
      (3) Static binding: If the method type is priavte the static final compiler will know exactly which method to call.
      (4) when a program runs and uses dynamic binding to invoke a method, the virtual machine must call the method version that matches the actual type of the object that X points to.
      (5) Dynamic binding: It is an important feature that makes the program extensible without the need to recompile the saved code.

14. Final class: To prevent others from deriving new classes from your class, this class is not extensible.

15. Dynamic calls take longer than static calls.

16. Abstract class: The class itself that specifies one or more abstract methods must be defined as abstract.

Example: Public abstract string Getdescripition

17. Each class in Java is extended from the object class.

18. The equal and ToString methods in the object class.

Equal is used to test whether an object is equal to another object.

ToString Returns a String representing the object, and almost every class overloads the method to return the correct representation of the current state.
(The ToString method is a very important method)

19. General programming: All values of any class type can be substituted with the object class variable.

20, array list: ArrayList dynamic array list, is a class library, defined in the JAVA.UITL package, can automatically adjust the size of the array.

21. The GetClass method in class object class returns an instance of the Ckass type, the class that is contained in the main method is loaded when the program starts, the virtual machines load all the classes that he needs, and each loaded class loads the classes it needs.

22, class for writing can dynamically manipulate Java code program provides a powerful function of reflection, this function for JavaBeans is particularly useful, using reflection Java can support VB programmers accustomed to use the tool.

A program that can analyze class capabilities is called a reflector, and the package called Java.lang.reflect, which provides this functionality in Java, is very powerful.

      1. Ability to parse classes at run time.
      2. Probe the object of the class at run time.
      3. Implement universal array manipulation code.
      4. Provide the method object.

And this mechanism is mainly for the tool and not the application and the program.

The most important part of the reflection mechanism is allowing you to examine the structure of the class. The APIs used are:

      Java.lang.reflect.Field returns the field.
      Java.reflect.Method Returns the method.
      Java.lang.reflect.Constructor returns the parameter.

Method Pointers: Java has no method pointers, passes the address of one method to another, can call it later, and the interface is a better solution.

23. Interface (Interface) describes what the class should do without specifying how to do it, and a class can implement one or more Interface.

24. An interface is not a class, but a set of specifications for a class that conforms to the interface requirements.

If implementing an interface requires 2 steps:

      1. Declare the specified interface that the class needs to implement.
      2. Provide a definition of all the methods in the interface.

Declaring a class implementing an interface requires the use of the Implements keyword

Class ACTIONB implements comparable its actionb need to provide a CompareTo method, the interface is not a class, you cannot instantiate an interface with new.

25. A class has only one superclass, but a class can implement multiple interfaces. An important interface in Java: cloneable

26. Interfaces and callbacks. A common pattern of programming is the callback pattern, in which you can specify a method on the callback object when a specific time occurs.

Example: ActionListener interface monitoring.
Similar APIs are: Java.swing.JOptionPane

java.swing.Timer 
java.awt.Tookit

27, the object Clone:clone method is a protection method of object, which means that your code can not simply call it.

28. Inner class: The definition of an inner class is a class that is defined within another.

The reasons are:

      1. An object of an inner class can access the implementation of the object that created it, including private data.
      2. For other classes in the same package, inner classes can be hidden.
      3. Anonymous inner classes can easily define callbacks.
      4. It is very convenient to write event drivers using an internal class.

29, the proxy class (proxies):

      1. Specify that the interface requires all code
      all methods defined by the 2.object class (ToString equals)

30. Data type:
Java is the language of the emphasis type, each variable must first declare its type, Java has a total of 8 basic types. 4 types are integer, 2 are floating-point type, one is character type, is used in Unicode encoding characters, Boolean type.
Questioner evaluation
Thank you!

Date Published: 2016-07-10 511 met

Category: Java, backend tags: java

How to learn Java for small white

Related Article

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.