Java Small White Starter essentials

Source: Internet
Author: User
Tags modifiers

A Java several definitions:

① object: An object is an instance of a class that has state and Behavior. For example, a dog is an object whose state is: color, name, variety, behavior: wagging the tail, barking, eating, etc.
② class: A class is a template that describes the behavior and state of a class of Objects.
③ Method: method is the behavior, a class can have many METHODS. Logical operations, Data modifications, and all actions are done in a method.
④ instance variables: Each object has a unique instance variable, and the state of the object is determined by the value of these instance Variables.

two. J Ava Syntax considerations:

① Case sensitive: Java is case-sensitive, which means that the identifier Hello is different from Hello.
② class name: for all classes, the first letter of the class name should be Capitalized. If the class name consists of several words, the first letter of each word should be capitalized, such as Myfirstjavaclass.
③ method Name: All method names should start with a lowercase letter. If the method name contains several words, the first letter of each subsequent word is Capitalized.
④ source file name: The source file name must be the same as the class Name. When saving the file, you should use the class name to save the filename (remember that Java is case-sensitive), and the suffix of the file name is. Java. (a compilation error is caused if the file name and the class name are not the same).
⑤ Main method Entry: All Java programs are executed by the public static void main (String []args) method.

Three. JAva identifier

All components of Java require a Name. Class names, variable names, and method names are called Identifiers.
For the Java identifiers, There are a few things to note:
① all identifiers should start with a letter (a-z or a-z), a dollar symbol ($), or an underscore (_)
② can be a combination of any character after the first character
③ keyword cannot be used as an identifier
④ identifiers are case-sensitive
Examples of ⑤ legal identifiers: age, $salary, _value, __1_value
Examples of ⑥ illegal identifiers: 123abc,-salary

Four. JAva modifier

There are two main types of modifiers:
Accessible modifiers: default, public, protected, Private
Inaccessible Modifiers: final, abstract, strictfp

Five. Introduction to J Ava Small example

Every language learning basically has to write a Hello world, below to See:

This article by Huayu Interconnect's leading education brand music Orange Valley provides!

This address: http://www.lechenggu.com/bbs/topic/582e62354c545131c1d46a26

Java Small White Starter essentials

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.