Java-Everything is an object

Source: Internet
Author: User
Tags deprecated

Java is a "purely" object-oriented language.
The identifier for the action is a reference to the object, and new is an object to create.

Storage location: Register \ Stack (reference) \ heap (new) \ Constant Store (inside program code) \ non-RAM storage (stream object and persisted object).
Basic type: Storage space size invariance (portable)-automatic packaging function.
High Precision numbers : BigInteger (integers of arbitrary precision), BigDecimal (decimals of arbitrary precision).
Array initialization: The array of objects is set to NULL, the use of references runs the Times error, and the base type array is 0 memory.

Java is a free form (the "{}" scope), and the object is created by new.
Java has a garbage collector that monitors all objects created with new and identifies objects that are no longer referenced, eliminating memory leaks.

The keyword class represents a class. Data members and member functions.
If the data member is a reference to an object, you must initialize the pointer to the actual object.
If the data member is a base type, it is initialized by default, but the local variable is not initialized and an error is provided.

The program appears to be just a series of object combinations with methods that use other objects as arguments and send messages to other objects.

The class library in turn uses its own Internet domain name, with the package name lowercase.
Java eliminates forward referencing, import imports a package or class library, and uses "*" to represent all classes.

The static keyword, an object that does not create a class can also use the static method and data.
Using the class name is the preferred way to reference static variables and methods.
The static method is likened to "shepherd", which is responsible for the care of a group of instances of the same type.

import java.util.Date;publicclass Main {    publicstaticvoidmain(String[] args) {        System.out.println("Hello, it‘s: ");        System.out.println(new Date());    }}

The beginning of the file requires an import declaration, and Java.lang automatically imports each Java file.

/** * Display Properties * Created by Wangchenlong on 15/7/5. */ public  class  showproperties  { public  static  void  main  (        String[] args) {system.getproperties (). List (System.out);        System.out.println (System.getproperty ());    System.out.println (System.getproperty ()); }}

Comments and embedded Documents:
@see: Links refer to other classes
{@link Package.class#member label}: for inline link reference
{@docRoot}: Relative path to the document root directory
{@inheritDoc}: Inherit document comments
@version: Version Information
@author: Author Information
@since: Earlier versions of program code
@param: Parameters
@return: Return value
@throws: Exception
@deprecated: Abandoned, new @deprecated

//: Object/hellodate.javaImportJava.util.Date;/** * Display A string and today ' s date. * @author C.l.wang * @author Caroline Wendy * @version /c5> 4.0 * / Public  class Main extends showproperties {    /** * ENTRV point to Class & application. * @param args Array of string arguments * @throws java.lang.Exception No Exceptions thrown */     Public Static void Main(string[] args) {System.out.println ("Hello, it ' s:"); System.out.println (NewDate ()); }/** * Output: * Hello, it ' s: * Sun Jul 21:32:28 CST *///:~}

Coding style:
Hump Style-The first letter of the class name is capitalized, and the method is lowercase.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java-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.