-
Java requires that the public class name be the same as the program file name.
-
Identifier in Java: preceded by a letter, underscore ' _ ' or dollar sign ' $ '; the other characters in the identifier must be letters, numbers, underscores, or $; identifiers cannot have spaces; identifiers cannot exceed 65,535 characters in length. The characters here are characters in the Unicode character set.
-
The public modifier indicates that this method can be used by other Java classes, which can be defined in the same file or in different files;
-
The static modifier description Method Main () is a service provided by the class and does not need to be associated with a specific class object. Such a method is called a class method.
-
The System.out is the standard output stream.
-
The text string in the program is not allowed to occupy more than a row. The following statements are illegal:
System.out.print ("Sdfasgsd
SDFASGFGFDG ");
-
Constants must be defined and initialized before constants are used in calculations. The keyword final is used to modify constants.
-
The use of System.out.print.
int num=10;
System.out.print ("Hello" +num);
-
Math.Round () is a class method of the Java.lang.Math standard class. The parameter is a floating-point number of type double that returns the nearest integer value.
-
Simple types of Java: Byte, short, int, long, char, double, float, Boolean.
-
Byte byte, short two bytes, int four bytes, long eight bytes, char one byte, float four bytes, double eight bytes, Boolean one. The float variable usually has only 6 valid digits, and the double value has 15 valid digits.
-
Lowercase converted to corresponding uppercase: Char lower= ' C '; Char upper= ' A ' +lower-' a ';
-
Java's Java.lang.Character provides a class method:
Char character.tolowercase (char ch) output corresponding lowercase letter
Char character.touppercase (char ch) output corresponding uppercase letters
-
Java defines constants in advance, which are members of Integer, double, and float, which are part of the standard package Java.lang.
Integer.max_value int Type the largest positive integer value
Integer.min_value the smallest positive integer value of type int
Double.max_value maximum positive value of type double
Double.min_value the smallest positive value of the double type
Double.positive_infinity double type positive infinite large value
Double.negative_infinity double type negative infinite large value
Double.NaN the value of the non-numeric type of the double type, which does not correspond to any number
-
System.out.print (1+2+ "3");
System.out.print ("1" +2+3);
Output:
33
123
-
Import java.io.*;
-