Javaoo 1-4 Chapter Study Focus

Source: Internet
Author: User

Data types in Java: base types, reference types

Basic types: Numeric type, byte type, shaping, long shaping, character type, Boolean type, etc.

Reference type: Class, interface, array;

Considerations for Using Identifiers:

1. Cannot start with a number

2. Case-sensitive

3. Cannot quote keywords

4. Hump naming Method (capital letter)

5. Pascal's nomenclature (first letter primary school, other words capitalized)

Application of π

π: Final data type constant name (all uppercase) = constant value

Input in Java

Header file:import Java.util.Scanner

public{

Scanner input (can be named) = new Scanner (system.in)

Input: System.out.println ("Please enter:");

int (data type) num (can be named) = Input.nextint ()

Input.nextint (); (receive shaping input)

Input.nextdouble (); (receive double type input)

Input.next (); (Receive string type input)

}

The minimum value of an integer in Java: integer. Min_value; (green part must be capitalized)

Random number in Java:(int) (Math.random () *100);

Strings in Java are compared equally:

Example: if ("Name". Equals (variable name))

Fully qualified name: Package name. class name. Fully qualified name

The package's reputation must be the first executable statement in the source file

Important Words: public protected protected private

Method: Public String toString () {

Return "name" +name+ "gender" +sex + "age" + Ages

}

Access modifier return value type method name (parameter list) {

Method Body: The function code block to be implemented

}

To create an object:

Example:

To create a student object:

Student stu = new Student ();

Stu. Variable name ();

Javaoo 1-4 Chapter Study Focus

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.