Operator:
Similar to C + +, Special:
1) Bitwise right SHIFT 0 Operator:
2) instanceof Operator: Determine if an instance is a class/interface type
Returns true if the/type is compatible
Superclassclass Vehicle {}//Subclassclass Car extends Vehicle {}public class test{public static void Main (String args[ ] {Vehicle a = new Car ();//Return TrueSystem.out.println (a instanceof Car);//Return TrueSystem.out.println (a instanceof Vehicle);}}
Modifier:
1) Access Control modifiers
is visible to the class within the same package.
In the interface: The variable is public static final, the method is public.
Classes and interfaces cannot be declared as private.
All public methods and variables of a class can be inherited by its subclasses.
Variables, methods, and constructors declared as protected can be accessed by any other class in the same package, or by subclasses in different packages .
The member variables and member methods of an interface cannot be declared as protected
@@@@@@@@@
@@@@@@@@@
2) non-access modifiers
- Static
- Static methods cannot use non-static variables of a class.
- Final
- The reference to the final object cannot be changed, but the value inside can be changed.
- Typically used with the static modifier to create class constants
- The final method in the class can inherit from the quilt class, but cannot be modified by the quilt class.
- Final class cannot be inherited
- Abstract
- If a class contains several abstract methods, the class must be declared as an abstract class.
- Abstract classes can contain no abstract methods.
- Synchronized
- transient modifier
- volatile modifier
public class Test{public static void Main (string args[]) {string str[] = {"A", "B", "PXY"};//variable ' s type = array ' s Ty Pefor (String word:str) {System.out.print (word + "*");}}}
java-basic-3-operator-modifier-loop