1, the output of the following code is
Packagetest;Importjava.util.Date; Public classSuperTestextendsdate{Private Static Final LongSerialversionuid = 1L; Private voidTest () {System.out.println (Super. GetClass (). GetName ()); } Public Static voidMain (String[]args) {NewSuperTest (). Test (); } }
Answer: Test. SuperTest
The GetClass () in object, which is final modified and cannot be rewritten. therefore, the method in object is called. Returns the Object run-time class for this. The returned Class object is an object that is locked by the method of the represented class static synchronized . That is, the current class. Class.getname () returns the name of the entity (class, interface, array class, base type, or void) represented by this class object as a String .
If you want to get the name of the parent class, then Super.getclass (). Getsuperclass (). GetName ()
2, ArrayList list = new ArrayList (20), the list in the extension several times
A: The space size is specified at 0 initialization and is created directly. If not specified,ArrayList list = new ArrayList (), each expansion will increase by 1.5 times times plus 1
3, the following section of code, its operation result is
public class stringdemo{ private static final String message= "Taobao"; public static void Main (string [] args) { string a = "Tao" + "Bao"; String b= "Tao"; String c= "Bao"; System.out.println (a==message); System.out.println ((b+c) ==message);} }
Answer: True False
4, the following code will print out
public static void Main (string[] args) { String classfile = "com. JD.". ReplaceA11 (".", "/") + "Myclass.class"; System.out.println (classfile);}
Answer: In regular expressions. Represents any character
5, observe the following code output is:
Class Car extends vehicle{public static void Main (string[] args) { new car (). run (); Private final void run () { System. println ("Car");} } Class vehicle{ private final void run () { System. println ("Vehicle");} }
A: The car parent class method has a private adornment, which is not visible for subclasses. So the method in the subclass is two methods
The second back of the Java plane question