Home  >  Article  >  Java  >  Relevant introduction to JAVA basics

Relevant introduction to JAVA basics

零下一度
零下一度Original
2017-07-20 10:28:301002browse

Chapter 1 Java Basics

Program goal: reduce the workload of a type of people in real life and improve work efficiency.

Students can eventually write systems:

Supermarket management system, POS machine system, etc.

Warehouse receipt

Sales slip

01 .Course Focus

Five key points:

01. Branch (selection) structure

02. Loop structure

03.Array

04. Double loop

05. Method with parameters

02. What is a computer program?

Analysis: It is a set of ordered instructions executed to complete a certain task.

03.What are the Java related technologies?

JavaSE (Desktop Application Development) JavaEE (Web Development)

Teacher, can you teach me how to determine whether a program is a desktop program or a web program?

Analysis: Browser:

IE

Sogou Browser (kernel IE) Maxthon Window of the World 360 QQ Cheetah

FireFox

Google

Opera

IE is not equal to a browser, it is just a type of browser

Judgment rules: If a program (software) can be executed without the help of a browser , then it is a desktop application

On the contrary, it is a web application.

Class example:

   "hello!"

Annotations

1. Member variables

Generally it is a basic data type, it can also be a reference type (pointing to other classes)

2. Member method (function)

Public Return type method name (parameter list)

Statement; //Method (function) body

Parameter list: representation Member function input

Return type (data type): Indicates member function output

Method (function) body: Indicates a code block to achieve a certain function

Note : The return type and the type of the return result must be the same

3. Construction method

Function: Complete the initialization of the new object

Features: The method name is the same as the class name and has no return value. When an object of a class is created, the system automatically calls the constructor method of the class to complete the initialization of the new object.

The difference and connection between classes and objects

1. Class is abstract and conceptual, representing a type of thing

2. Object is concrete and actual, representing a specific thing

3. A class is the template of an object, and an object is an individual of the class.

Two methods to create an object

1. Declare first and then create

Object declaration: class name object name

Object creation: object name = new class name ()

2. One-step method

Class name object name = new class Name();

Object access member variable method

Object name.Variable name;

The difference between overloading and overwriting

Overloading

Simply put, it means that functions or methods have the same name but different parameter lists. Such functions or methods with the same name and different parameters are called overloaded functions or methods. method.

Rewriting

Rewriting refers to the situation where there are two methods with the same name and parameter list in the Java subclass and the parent class. Since they have the same method signature, the new method in the subclass will override the original method in the parent class.

Bit operations and shift operations

There are 4 bit operations in Java, namely bitwise AND&, bitwise OR|, Bitwise XOR ^, bitwise negation.

The operation rules are:

Bitwise AND&: both two bits are 1, the result is 1

Bitwise OR|: one of the two bits is 1, the result is 1

Bitwise XOR: two bits, one bit is 0, one bit is 1, the result is 1

Bitwise inversion: 0->1,1->0

There are three shift operators in Java:

>>, << Arithmetic right shift and arithmetic left shift

Operation rules:

Arithmetic Right shift: the low bit overflows, the sign bit remains unchanged, and the overflowed high bit is filled with the sign bit

Arithmetic left shift: the sign bit remains unchanged, the low bit is filled with 0

>>> Logical right Shift

The low bit overflows, the high bit is filled with 0

The above is the detailed content of Relevant introduction to JAVA basics. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn