Overview of Java Basics

Source: Internet
Author: User
Tags stringbuffer

Write at the beginning

I do not have a very good technology to summarize the past life of Java, here is the main combination of their own basic understanding of Java, roughly to some summary.

Combine some of the books that I recently read, summed up, as this sentence says: read a bit and take it out,then come back Read some more.

Body 1. 4 Types of Java language support: Interface, class, array, primitive

The first three are commonly referred to as reference types, class instances, arrays are objects (object), and primitive values are not object.

Primitive basic types, a total of 8 kinds:char (character), Byte,int,short,long, (Integer) Boolean (Boolean), float,double (floating point type)

2. Key word Mastery is necessary

Keywords are lowercase must note that the detailed description can be seen in one of my previous articles mentioned.

A few methods of the 3.Object class, you must know

The object class defines approximately 7 methods for native keyword adornments:

Registernatives ();
GetClass ();
Hashcode ();
Clone ();
Notify ();
Notifyall ();
Wait (long timeout)

4. Equal, the difference between "= ="

Equal: Compares the size of the values that exist in the heap;

and "= =": Compare is the address stored in the stack is the same, often equal to true, "= =" is not necessarily true.

5. The difference between abstract classes and interfaces

The difference is still obvious,

From a grammatical point of view, they give different language definitions, an abstract keyword modifier class, and a interface

From the design level, abstract classes are abstractions of the entire class, including properties and methods (behaviors), whereas interfaces are simply abstractions of behavior

Cross-domain difference: Abstract class embodies an inherited relationship extends, and interface embodies a kind of realization class relationship Implement

The difference between 6.String, StringBuffer and StringBuilder

The string object is immutable; string is the final modifier of the keyword, decorated with constants, thread-safe

Both StringBuffer and StringBuilder inherit from the Abstractstringbuilder class, so the length is variable.


StringBuffer has a synchronous lock on the method, is thread-safe, and StringBuilder has no synchronous lock and is non-thread-safe.


Each time the string is modified, a new string object is created, and the pointer points to the new object;

StringBuffer Each modification is the operation of the object itself, StringBuilder compared to StringBuffer no synchronization lock, relative performance has improved, but relatively small, probably 10%~15%, but in the multi-threaded insecure.



Overview of Java Basics

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.