Java entry-level books

Source: Internet
Author: User

Java entry-level books

After the project has been completed in the past few days, I have been idle. I want to write code and entertain myself. By the way, I want to study the background.

Java Definition

① Object: an object is an instance of a class and has statuses and behaviors. For example, a dog is an object in the following states: color, name, breed, and behavior: tail shaking, calling, and eating.
Class 2: A class is a template that describes the behavior and status of a class of objects.
③ Method: A method is a behavior. A class can have many methods. Logical operations, data modifications, and all actions are completed in the method.
④ Instance variable: each object has a unique instance variable. The object State is determined by the value of these instance variables.

 

Java syntax considerations

① Case sensitive: Java is case sensitive, which means 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 is composed of several words, the first letter of each word should be capitalized, for example, MyFirstJavaClass.
③ Method Name: All method names must start with a lowercase letter. If the method name contains several words, the first letter of each word is capitalized.
④ Source file name: the source file name must be the same as the class name. When saving a file, you should use the class name as the file name (remember that Java is case sensitive) and the file name suffix is. java. (If the file name and class name are different, the compilation will be incorrect ).
⑤ Main method entry: All Java programs are executed by the public static void main (String [] args) method.

 

Java identifier

All components of Java must be named. The class name, variable name, and method name are all called identifiers.
For Java identifiers, note the following:
① All identifiers should start with a letter (A-Z or a-z), dollar sign ($), or underscore (_)
② The first character can be a combination of any character
③ Keywords cannot be used as identifiers
④ The identifier is case sensitive.
⑤ Examples of valid identifiers: age, $ salary, _ value, and _ salesvalue
6. Example of invalid identifiers: 123abc and-salary

 

Java Modifier

There are two main modifiers:
Accessable modifiers: default, public, protected, private
Inaccessible modifier: final, abstract, strictfp

 

Example of getting started with java

For every language, you need to write a Hello World. Next let's take a look at the IDEA editor. It's pretty good to use it now.

public class HelloWorld {    public static void main(String[] args) {        System.out.print("hello world");    }}

 

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.