Regaining the basics of Java (2): Summary of basic Java syntax
Regain the basics of java (2): Summary of basic java syntax
1. Installation and configuration of EditPlus
安装——工具——添加工具——程序——菜单文本(编译)—— 命令(C:\Developjava\JavaJDK\jdk1.7.0_75\bin\javac.exe)——参数(文件名)——起始目录(文件目录窗口所在目录)—— 应用——确定; 安装——工具——添加工具——程序——菜单文本(运行)—— 命令(C:\Developjava\JavaJDK\jdk1.7.0_75\bin\javac.exe)——参数(文件名不含拓展名)—— 起始目录(文件目录窗口所在目录)——应用——确定;
2. Constants: given in the program Variable amount;
整型 浮点型 字符型 char 字符串 String 空常量 null 布尔常量
3. Base number
二进制 八进制 十六进制 十进制
4. Base conversion
倒除法 逐位数字与进制的数字位数的次方相乘然后再相加; 二进制 在数据之前加0b 八进制 在数据之前加0 十六进制 在数据之前加ox
5. Data type
整形(byte short int long) 浮点型 (float double) 字符型 char 变量赋值时需要加单引号,例如 char ch = ‘f’ 布尔类型 boolean 字符串类型 String 变量赋值时需要加双引号, 例如 String s = “how are you”
6. Type conversion
自动类型转换 小类型转换为大类型,小范围转换为大范围 byte 、short、char——int——long ——float——double 数学运算符对与基本数据类型的影响: 1.不同类型在运算时,小类型会转换为大类型进行运算。 2.byte、short、char参与运算时,首先都会先转换为int类型然后参与运算。 强制类型转换 (定义类型)变量名 = (强制类型)值 注意:我们需要根据实际情况,只有这个值确实属于目标类型的时候才可以转换。 变量和常量在运算时: 变量和变量是变量 常量和常量相加是常量。 常量先运算结果 变量先转换类型。
7. Variables: Requirements defined in the program
1. 数据类型 变量名; 变量名 = 值; 2. 数据类型 变量名 = 值; 3. 数据类型 变量1=值1,变量2;
8. Operators
算术:+ 、-、*、/、%、++、-- 、+ 赋值:=、 +=、 -= 比较:<、>、>=、<=、!= 逻辑:&、&&、|、|| 、!、^ 三目(位、元):(布尔运算)?值1:值2 位移(了解) :<< 左移 >> 右移 位移为二进制编码的补码进行移动 算术 + - * % 取余 / 取整 ++ 自增 变量+1 如果变量在前,则整个式子的值+1之前的值。 如果变量在后,则整个式子的值+1之后的值。 -- 自减 变量-1 如果变量在前,则整个式子的值-1之前的值。 如果变量在后,则整个式子的值-1之后的值。 + 字符串的相加 字符串无论和什么类型相加,都是字符串拼接。 赋值 = 赋值 += 相加之后赋值 a+=5相当于 a=a+5 -= 相减之后赋值 a-=5相当于 a=a-5 *= 相乘之后赋值 a*=5相当于 a=a*5 %= 取余之后赋值 a%=5相当于 a=a%5 /= 取整之后赋值 a/=5相当于 a=a/5 比较: == 相等 != 不等 > < >= <= 逻辑: 与:两个式子都为true则结果为true,否则结果为false & && 或:只要有一个式子为true结果为true,否则为false | || 非: 取反
The above is to regain the basics of java (2): Summary of basic Java syntax. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Perfect Number in Java. Here we discuss the Definition, How to check Perfect number in Java?, examples with code implementation.

Guide to Random Number Generator in Java. Here we discuss Functions in Java with examples and two different Generators with ther examples.

Guide to Weka in Java. Here we discuss the Introduction, how to use weka java, the type of platform, and advantages with examples.

Guide to Smith Number in Java. Here we discuss the Definition, How to check smith number in Java? example with code implementation.

In this article, we have kept the most asked Java Spring Interview Questions with their detailed answers. So that you can crack the interview.

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

Guide to TimeStamp to Date in Java. Here we also discuss the introduction and how to convert timestamp to date in java along with examples.

Capsules are three-dimensional geometric figures, composed of a cylinder and a hemisphere at both ends. The volume of the capsule can be calculated by adding the volume of the cylinder and the volume of the hemisphere at both ends. This tutorial will discuss how to calculate the volume of a given capsule in Java using different methods. Capsule volume formula The formula for capsule volume is as follows: Capsule volume = Cylindrical volume Volume Two hemisphere volume in, r: The radius of the hemisphere. h: The height of the cylinder (excluding the hemisphere). Example 1 enter Radius = 5 units Height = 10 units Output Volume = 1570.8 cubic units explain Calculate volume using formula: Volume = π × r2 × h (4
