1. Each class uses object as the superclass. So objects (including arrays) implement this class of methods.
2. In cases where the superclass is not explicitly given, Java automatically takes object as the superclass to be defined.
You can use a variable of type object to point to any type.
The 3.Object class has a default constructor, public Object (), which calls this default constructor first when constructing an instance of the class.
Variables of the 4.Object class can only be used by a variety of worthy generic holders. To do anything specific to them, you need to know their original type and make the type conversion.
Object obj=new MyObject ();
MyObject x= (MyObject) obj;
Public classtest{Final inta=10;intb=2; PublicTest (intnum) { This. A=num;} Public intresult () {returnA +B;} Public Static voidMain (string[] args) {test test=NewTest (20);intC=Test.result (); System.out.println ("The value of C is" +c);}}
The subject final keyword modifies the variables, classes, and members of the class. The final keyword modifies the variable once the assignment cannot be changed again.
Object-oriented design error is (A)
A, the object-oriented programming thought should be obviously superior to the process-oriented design idea.
B, object-oriented is the basic design idea of Java speech
C, class is the most basic content in Java
D. Object-oriented design ideas use encapsulation, inheritance and polymorphism to implement code from.
Final keyword error (D)
A. A class that is final modified cannot be inherited
B. Final modified imagining cannot be overridden by a quilt class
C. The final modified variable will be a constant light
D.final can modify a class or method at the same time as an abstract
Final can be used in front of the class name, indicating that the class is not inheritable, and final is used before the variable, indicating that it is a variable that can only be assigned once, if initialized that is a constant.
Static can be used before a variable or method inside a class to indicate that it is a variable and method shared by the entire class, regardless of the class object.
You cannot use both final and abstract to decorate a class or method at the same time.
Java about the ToString method is correct (A.B);
The ToString implemented in a custom class is overridden by the object class.
B All objects have the ToString method.
C.tostring is a unique method of the String class
D If a class has the ToString method systemout.pring must be written obj.tostring ();
The use of the ToString () method of the object class. All objects are subclasses of the object class and are therefore able to inherit their ToString () method, which can be overridden in this class according to the requirements of the ToString () method. In the console output, you can write the object name directly, omitting. ToString (). such as System.out.print (object name).
The right word is (CD)
A. The final modified method cannot be overridden or static modified
B. The final modified method can also be modified with the abstract
The C.final method cannot be overridden, but can be modified by static
The Dfinal method can be modified by the abstract
This is the final keyword modification method. Methods that are decorated with the final keyword cannot be overridden, can be modified by static, but cannot be modified by an abstract.
Right is ()
public class Test
{
Private static Final Boolean flg=true;
Private static Final Boolean open=fals;
public static void Main (string[] args)
{
if (open)
{
Flg=false;
}else
{
Flg=true;
}
System.out.printin (FLG);
}
}
Compilation error. When final modifies a variable, the variable cannot be assigned a value.
So FLG = false; and FLG = true;
Java Chapter Three wrong question