JAVA utility function practice summary

Convert the value in the string variable to uppercase: toUpperCase().

There are two methods for concatenating strings: + and concat (string variables).

Return the index position of a letter in the string: indexOf("e") //Return the position of e.

Returns the square root: sqrt()   

Return a random number: math.random() //This can only return a random number from 0 to 1.

Ternary operator: (judgment statement)? True : False

Select statement: switch (variable) { case variable value: output statement break; case variable value: ~ }

Simple way to traverse the array: for(String i:array ){ }

Print the number of arrays: array.length  

Some knowledge that Java needs to remember:

1. Java is called a "platform independent language" because it mainly follows the principle of "compile once, run anywhere".

2. JDK is the core component of the Java environment, providing all the tools, executables and binaries needed to compile, debug and execute Java programs.

3. Pointers are not a Java feature. Java provides an efficient abstraction layer for developing without pointers in Java. The characteristics of Java programming are portable, architecture-neutral, object-oriented, robust, safe, dynamic and extensible, and so on.

4. Keywords are specially reserved words and cannot be used to name user-defined variables

5. JAVA_HOME is used to store the path of java installation.  Not JAVA_PATH Oh!

6. There are 4 OOPS concepts in Java. Inheritance, encapsulation, polymorphism and abstraction. Note that compilation belongs to the role of JDK components.

7. "this" is an important keyword in java. It helps to distinguish between local variables and variables passed as parameters in methods.

8. Note that the output of local variables will not affect the whole.

9. There are two types of polymorphism in Java. Compile-time polymorphism (overloading) and runtime polymorphism (overriding).

10. The left shift operator means <<. Shifting left is equivalent to multiplying by 2*2. The result is the variable multiplied by 4.

11. What is truncation in Java? Assignment to a floating-point value of integer type

12. The object class is the superclass of every class in Java.

13.java.lang contains exception stack overflow in Java.

14.Public, private, protected and default are the access modifiers. (Not access modifiers.)

Guess you like

Origin blog.csdn.net/qq_55928086/article/details/131792463