Do you know the most basic java interview questions?

java legal identifier

标识符可以由数字,字母,_下划线,$组成,不能数字开头,不能有空格
Identifiers are strictly case-sensitive.
Identifiers cannot be Java keywords or reserved words.
Identifier naming should best reflect its role.

Java basic data types
Insert picture description here
display conversion and implicit conversion

Explicit type conversion is also called 强制类型转换.
From the type with a large storage range to the type with a small storage range.
The specific rules are:
double→float→long→int→short(char)→byte

Implicit conversion is called 自动类型转换. Type conversion done automatically by the system.
From a type with a small storage range to a type with a large storage range:
byte ->short(char)->int->long->float->double

What are JDK, JRE and JVM

JDK(Java Development Kit)是Java开发工具包
JDK is the core of the entire JAVA, including the Java runtime environment JRE, a bunch of Java tools (javac/java/jdb, etc.) and Java-based class libraries

JRE(Java Runtime Envirnment)是Java运行环境

JVM(Java Virtual Machine)是Java的虚拟机,是JRE的一部分. It is the core part of the entire java implementation of cross-platform, responsible for interpreting and executing bytecode files, and is a virtual computer that can run java bytecode files.
The JVM on all platforms provides the same interface to the compiler, and the compiler only needs to face the virtual machine, generate code that the virtual machine can recognize, and then the virtual machine interprets and executes it.

Why Java is cross-platform

When using a Java compiler to compile a Java program, it generates platform-independent bytecodes, which are only for JVM. JVMs on different platforms are different, but they all provide the same interface.
JVM is the core part of the cross-platform Java program. As long as the corresponding virtual machines are implemented for different platforms, the compiled Java bytecode can run on that platform.

Array
Delete the i-th element in a sequence table of length n, and move ___ elements. If you want to insert an element before the i-th element, move back ___ elements.

Answer: ni, n-i+1

Guess you like

Origin blog.csdn.net/qq_42524288/article/details/107246791
Recommended