1024programmer News JAVAOO1-4 chapter learning focus

JAVAOO1-4 chapter learning focus

Data types in JAVA: basic types, reference types

Basic types: numeric, byte, integer, long integer, character, Boolean, etc.;

Reference type: class, interface, array;

Notes on using identifiers:

1. Cannot start with a number

2. Case sensitive

3. Cannot quote keywords

4. CamelCase (first letter capitalized)

5. Pascal’s nomenclature (first letter primary, 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 (nameable) = new Scanner(System.in)

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

int (data type) num (optional name) = 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; (the green part must be capitalized)

Random numbers in java: (int)(Math.random()*100);

String comparisons in java are equal:

Example: if(“name”.equals(variable name))

Fully qualified name:package name.package name.class name.fully qualified name

The package name must be the first executable statement in the source file

Important words: public public protected protected private private

Method: public String toString(){

return “name”+name+”sex” +sex + “age” + age

}

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

Method body: function code block to be implemented

}

Create object:

Example:

Create a student object:

Student stu = new Student();

Stu. variable name ();

JAVAOO 1-4 chapter learning focus


This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/javaoo1-4-chapter-learning-focus/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索