Java Basics Summary

Source: Internet
Author: User
Tags float double static class

1.8 Basic data types

Integral type: byte short int long

Float type: float double

Character type: Char

Boolean type: True,false

Java type, + on both sides of the default is an int type cast example: int a = four byte num = (byte) a

2. Reference data type: String class

3. Naming conventions

A. Class names cannot start with numbers, special symbols, lowercase letters

b, using small hump-type naming

c, do see the name of the idea

Package naming: All lowercase company names. Name of the project.

4. Array 1. Array type identifier [] = new data type {value 1, value 2}

2. Array type identifier []= {value 1, value 2}

5. Functions

Format: Permission modifier return value type function name (type parameter) {}

Example public String Demo () {

}

6. Object-oriented

Features: Encapsulation inheritance polymorphism

Create object class Name Object name = new class name ();

Invocation of the method

static invocation of static class name calls static invoke non-static instantiation call

1. Anonymous objects

Definition: An object without a name

Features: 1. No meaning when assigning a value to a property

2. Used when calling the method, and can only use 1 times

3. Can be used as a parameter pass

2. Blood Loss model-encapsulation

Definition: Hides the properties and implementation details of an object, providing only public access.

Function: Hide detail security to improve code reuse

Principle: Hide content that does not need to be provided externally and provide interfaces using getter and setter methods.

This keyword: a reference to the current object to distinguish between local variables and global variables with duplicate names

Overloading (overload): In the same class, the method name is identical, and the parameter list [parameter type Order] is different, regardless of the return value.

    

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