Everything is an object.

Source: Internet
Author: User
Tags deprecated

A Java-manipulated identifier is a reference to an object.

Where the data is stored:

Register: The fastest storage area, located inside the processor, but limited in number, should be allocated on demand.

Stacks: Fast and efficient allocation of storage methods, second only to registers, in general RAM. Direct support from the processor is available through the stack pointer. The stack pointer moves down to allocate new memory, and if you move up, the memory is freed.

Heap: Storage allocation and cleanup with heaps can take more time than storage allocation with stacks, a common memory pool that resides in RAM and is used to hold all Java objects.

Constant storage: Stored directly inside the code.

Non-RAM storage: If the data is completely out of the program, it can be free from any restrictions on the program and can exist when the program is not running. A stream object and a persisted object. In a Stream object, the object is converted into a byte stream and sent to another machine. In persistent objects, objects are stored on disk, and the trick is to turn objects into things that can be stored in other mediums. You can revert to a regular, ram-based object when needed.

Base type: Instead of creating a new one, you create an automatic variable that is not a reference change. This variable stores the value directly and places it on the stack.

Java provides two classes for high-precision computing: BigInteger and BigDecimal. There is no corresponding basic type. BigInteger supports integers of arbitrary precision. BigDecimal supports fixed-point numbers with arbitrary longitude.

When you create an array object, you actually create a reference array, and each reference is automatically initialized to a specific value that has its own keyword, null. When you create an array of basic data types, the compiler resets all of the memory occupied by the array to zero.

Scope (scope) determines the visibility and life cycle of the variable names defined therein. The scope is determined by the position of the curly braces. Java objects do not have a life cycle of basic types. When you create a Java object with new, it can survive outside the scope.

Base member Default value: Boolean false char \u0000 (NULL) byte 0 shrot 0 int 0 Long 0L float 0.0f Double 0.0d. The default value is not appropriate for local variables. If you define a local variable, such as int x, it may be any value and will not be automatically initialized to 0.

The Java approach determines what messages an object can accept. The basic composition of a method consists of a name, a parameter, a return value, and a method body. The return type strokes the value returned from the method after the method is called; the parameter list gives the type and name of the information to be passed to the method, the method name, and the parameter list, which uniquely identifies a method. In the argument list, you must specify the type and name of each lock-passing object, and actually pass the reference.

The Java designer wants programmers to use their own Internet domain name in turn, reversing the domain name to represent the sub-directory partition.

Static application scenario: only want to allocate a single storage space for a particular domain, not to consider how many objects to create or not to create any objects at all; you want a method to be associated with any object that does not contain its class, so when you declare a transaction to be static, it means that even if there is no object, This method can also be called.

Use class data and class methods to represent those that exist only as an entire class and not as a specific object of a class.

Javadoc is a tool for extracting annotations, and his output is an HTML document. All Javadoc commands can only appear in "/**", ending with "*/". There are two main ways to use Javadoc: Embed HTML or use a "document label". Stand-alone documents are commands that begin with the @ character and are placed at the top of the comment line. The in-line document label can appear anywhere in the Javadoc comment. Also starts with "@", but is enclosed in curly braces. There are three types of annotation documents, corresponding to the three elements that follow the comment location: classes, fields, and methods. Javadoc only document comments for public and protected members. Comments for private and reported access members are ignored. Javadoc sends HTML commands through the generated HTML document.

/**                                                                             /**

*<pre> * You can <em> even </em> i Nsert a list

*system.out.println (new Date) *<ol>

*</pre> *<li>item 1</li>

*/*</ol>

*/

Asterisks and leading spaces at the beginning of each line are discarded by Javadoc. Do not use header tags in embedded HTML, Javadoc will insert its own title

Javadoc label

@See classname Javadoc adds a "see Also" entry with a hyperlink in its generated HTML, but does not check that the hyperlink is valid

{@link Package.class#member label} is used only for behavior, and is used as a label seat hyperlink text instead of See also, for @see consistent

{@docRoot} This label produces a relative path to the root of the document and is used for display hyperlinks on the document Tree page

{@inheritDoc} This tag inherits the relevant document from the most direct base class of the current class to hit the current document comment

@version Important information that contains release notes

@author information about the author

@since This tag allows you to make the earliest version of your program code, and you can see in the HTML Java document how it was used to make the JDK version used.

@param identifiers in the argument list

@return return value meaning

@throws an object that was thrown because a method call failed

@deprecated the label is used to indicate that some of the old features have been superseded by the improved new features, it is recommended that users do not use these old features, and if you use a tag as @deprecated method, the compiler will publish a warning

Demo:

Import java.util.*;

/**

* The first thinking in Java example program

* Displays a string and today ' s date

* @author Bruce Eckel

* @author www.MindView.net

* @version 1.0

*/

public class hellodate{

/**

* ENTRV point to class and application

* @param args array of string arguments

* @throws Exception No Exception thrown

*/

public static void Main (String args[]) {

System.out.print ("Hello,it S");

System.out.print (New Date ());

}

}

The Java programming language code specifies that the first letter of the class name be capitalized, and if the class name consists of several words, the first letter of each word is capitalized when it is spelled together. Methods, fields, and references to objects are camel-style, with only one letter of the identifier in lowercase.

Everything is an object.

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.