Data types in Java: base types, reference types
Basic types: Numeric type, byte type, shaping, long shaping, character type, Boolean type, etc.
Reference type: Class, interface, array;
Considerations for Using Identifiers:
1. Cannot start with a number
2. Case-sensitive
3. Cannot quote keywords
4. Hump naming Method (capital letter)
5. Pascal's nomenclature (first letter primary school, 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 (can be named) = new Scanner (system.in)
Input: System.out.println ("Please enter:");
int (data type) num (can be named) = 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; (green part must be capitalized)
Random number in Java:(int) (Math.random () *100);
Strings in Java are compared equally:
Example: if ("Name". Equals (variable name))
Fully qualified name: Package name. class name. Fully qualified name
The package's reputation must be the first executable statement in the source file
Important Words: public protected protected private
Method: Public String toString () {
Return "name" +name+ "gender" +sex + "age" + Ages
}
Access modifier return value type method name (parameter list) {
Method Body: The function code block to be implemented
}
To create an object:
Example:
To create a student object:
Student stu = new Student ();
Stu. Variable name ();
Javaoo 1-4 Chapter Study Focus