Java interview set

xiaoxiao2021-03-05  24

Looking for a job to interview, there is an interview with a way to deal with the interview. Some of the following topics come from me and my friend's painful interview experience, including these issues include IBM, E * Trade, Siebel, Motorola, Sun, and other size companies. There is no reason for the interview, and it is unreasonable, and it is out of practice. Have written on paper, there is a face test you, and there is also a question in the phone, giving you the estimate of the IDE, so you can buy a lottery ticket, maybe it is specified. So if you have finished reading this article, please don't complain that these problems can be solved with IDE. You have to answer these questions in any case, if you have one or two questions in the interview, you will be able to be rejected. Of course, these are the basic questions of Java. Most people who have interviews will not ask you how Hibernate has more advanced, Eclipse's three components, or Command Design Pattern, they are all aged, and the favorite is basics. . Don't underestimate these foundations, my friend is first-class, and the results are planted under the basis of basics, and the high salary is not worthy. Looking for a job to interview, there is an interview with a way to deal with the interview. Some of the following topics come from me and my friend's painful interview experience, including these issues include IBM, E * Trade, Siebel, Motorola, Sun, and other size companies. There is no reason for the interview, and it is unreasonable, and it is out of practice. Have written on paper, there is a face test you, and there is also a question in the phone, giving you the estimate of the IDE, so you can buy a lottery ticket, maybe it is specified. So if you have finished reading this article, please don't complain that these problems can be solved with IDE. You have to answer these questions in any case, if you have one or two questions in the interview, you will be able to be rejected. Of course, these are the basic questions of Java. Most people who have interviews will not ask you how Hibernate has more advanced, Eclipse's three components, or Command Design Pattern, they are all aged, and the favorite is basics. . Don't underestimate these foundations, my friend is first-class, and the results are planted under the basis of basics, and the high salary is not worthy. It's better to say less nonsense and start the topic. First, talk about the difference between Final, Finally, Finalize. Final is used to declare attributes, methods, and classes, indicate that attributes are unambiguous, and the method is not covered, and the class cannot be inherited. Finally is part of an exception handling statement structure, which is always executed. Finalize is a method of the Object class. This method of recycling object is called when the garbage collector is executed, and other resource recycles when this method is available, such as turning off files. Second, Anonymous Inner Class (anonymous internal class) can be extends other classes, can IMPLEMENTS INTERFACE? Inherit other classes or complete other interfaces, in this way in Swing programming. Third, Static Nested Class and Inner Class are different, the more you say, the better (the interview question is very general). Static NESTED CLASS is an internal class that is declared as static (STATIC), which can not depend on external class instances being instantiated. The usual internal classes need to be instantiated after instantification of external classes. The difference between fourth, & and &&.

& A bit operator, representing bit and operation, && is a logical operator, representing logic and (AND). Fifth, havehmap and havehtable. HashMap is a lightweight implementation of HashTable (non-thread security), they all completed the MAP interface, mainly distinguishing the HashMap allows empty (NUY) key value (key), due to non-threaded security, efficiency may be higher than HashTable. Sixth, the difference between Collection and Collectes. Collection is the superiors of the collection class, inheriting the interface with his interface, mainly SET and List.Collections are a help class for the collection class, and he provides a series of static methods to achieve search, sorting, thread security for various sets. . Seventh, when do you use Assert. 1.4 New keywords (syntax) for testing the Boolean expression status and can be used for debugging. How to use Assert , indicating that if the expression is true (TRUE), then the following statement is executed, otherwise you will throw AssertionError. Additional way of use Assert : , indicating that if the expression is true, the rear expression is ignored, otherwise the value of the rear expression is used for the build parameters of AssertionError. Pay attention to compile-Source 1.4 parameters, otherwise error. ] To increase the -ea parameters while running, otherwise the Assert line is ignored what is the eighth, GC? Why do you have GC? GC is the meaning of garbage collection, memory processing is where the programmer is easy to have problems, forget or The wrong memory recycle causes the unstable or even crash of the program or system. The GC function provided by Java can automatically monitor whether the object exceeds the scope to reach the automatic recycling memory, and the Java language does not provide a display operation method that releases the allocated memory. Ninth, string s = new string ("xyz"); created a few string object? Two tenth, Math.Round (11.5) equal to how much? Math.Round (11.5)? Math.Round (11.5 ) == 12Math.Round (-11.5) == - 11Round method Returns the length intensity closest to the parameters, the parameter plus 1/2 is followed by its floor. Eleventh, Short S1 = 1; S1 = S1 1; What is wrong? Short S1 = 1; S1 = 1; What is wrong? SHORT S1 = 1; S1 = S1 1; (S1 1 calculation result is INT type, need forced conversion type) Short S1 = 1; S1 = 1; (can be compiled correctly) The twelfth, SLEEP () and WAIT () What is the difference? Sleep is a thread method, causing this thread to suspend the specified time, give the execution opportunity to give other threads, but monitor The state remains automatically after it is time. Calling SLEEP does not release the object lock.

WAIT is the object of the object class. Call the WAIT method for this object causes the lecture to abandon the object lock. Enter the waiting lock pool waiting for this object, only the NOTIFY method (or NotifyAll) is issued after this object, after entering the object lock pool ready to get Object locks enter the operating state. Thirteenth, have java goto? There is no very thirteen problem. If I ask this question, I advise you to pay back this company. (End) (Job.sohu.com) Fourteenth, there is a length () method for the array? String has a length () method? The array does not have Length () method, with the properties of the length. String has a length () method. Fifteenth, the difference between overload and override. OverLoaded method can change the type of return value? Override Overriding and overload overloading is a different manifestation of Java polymorphism. Overriding Overriding is a manifestation of polymorphism between parent class and subclasses, and overloading overloading is a manifestation in a class. If a method is defined in the subclass with the same name and parameters as its parent class, we say that this method is overriddled. When the subject of subclass uses this method, the definition of the subclass will be called. For it, the definition in the parent class is like "shielded". If a plurality of the same names are defined in a class, they or have different parameters or different parameter types, called overloading. The way OVERLOADED is to change the type of return value. The elements in the SET are not repeated, then what method is used to distinguish whether it is repeated? Is it == or equals ()? What is the difference between them? The elements in Set cannot be repeated, then use Iterator () Method to distinguish whether it is repeated. Equals () is the judgment of whether two SETs are equal. Equals () and == Method Decide whether the reference value points to the same object Equals () override in the class, which is the true value of the content and type of two separate objects. Seventest, give me a Runtime Exception you most often.

ArithmeticException, ArrayStoreException, BufferOverflowException, BufferUnderflowException, CannotRedoException, CannotUndoException, ClassCastException, CMMException, ConcurrentModificationException, DOMException, EmptyStackException, IllegalArgumentException, IllegalMonitorStateException, IllegalPathStateException, IllegalStateException, ImagingOpException, IndexOutOfBoundsException, MissingResourceException, NegativeArraySizeException, NoSuchElementException, NullPointerException, ProfileDataException, ProviderException, RasterFormatException, SecurityException, What is the difference between systemException, undeclaredthrowableException, unmodifiablesetexception, unsupportedopertyXception, error, and exception? Error indicates a serious problem that recovery is not impossible but very difficult. For example, memory is overflow. It is impossible to expect the program to handle this situation. Exception represents a design or implementation problem. That is, it means that if the program runs normally, it will never occur. Ninth, List, SET, MAP inherits from the Collection interface? List, SET is Map is not the twentieth, what is the difference between Abstract Class and Interface? Declaration method does not implement its class called abstract class (Abstract Class, it is used to create a class that reflects certain basic behavior and declares the class for this class, but cannot implement the class in this class. An instance of the Abstract class cannot be created. However, you can create a variable, which is an abstract class and let it point to an instance of the specific subclass. There is no abstract constructor or abstract static method. Subclasses of the Abstract class provide implementation for all abstraction methods in their parent class, otherwise they are also abstract classes. Instead, this method is implemented in the subclass. Other classes that know their behavior can be implemented in the class. Interface is a variant of an abstract class. In the interface, all methods are abstract. Multiple inheritance can be obtained by achieving such an interface. All methods in the interface are abstract, no probabilities. The interface can only define the Static Final member variable. The implementation of the interface is similar to the subclass, except that the implementation class cannot inherit behavior from the interface definition. When the class implements a special interface, it defines the method of all such an interface (that is, the program body is given). Then, it can call the interface to call the interface on any object of the class of the interface. Because there is an abstract class, it allows the interface name as the type of reference variable. The usual dynamic cable will take effect. The reference can be converted to an interface type or a slave interface type, and the InstanceOf operator can be used to determine whether an object is implemented. Second Eleventh, whether the method of abstract can be static at the same time, whether it is native at the same time, whether it can be SYNCHRONIZED? Can't the twenty-two, whether the interface can inherit the interface? Does the abstract class can implement (imports) interface? Abstraction Whether the class can inherit the physical class (Concrete Class)? The interface can inherit the interface.

Abstract classes can be implemented, whether abstract classes can inherit physical classes, but provided that the entity class must have a clear constructor. Second, the thirteenth, starting a thread is Run () or start ()? Starting a thread is calling the start () method so that the virtual processor represented by the thread is running, which means it can be scheduled by JVM and carried out. This doesn't mean that the thread will run immediately. The Run () method can generate a flag that must be exited to stop a thread. Chapter 24. Whether the constructor can be can't be inherited by the Override® constructor constructor, so Overriding cannot be overridden, but Overloading can be overloaded. The second fifteenth, can you inherit the String class? The String class is not inherited by Final. Twentydays, when a thread enters an SYNCHRONIZED method of an object, other methods of other threads can enter this object? No, one Synchronized method of an object can only be accessed by one thread. 27. There is a Return statement in Try {}, so the code in finally {} after this try is not executed, when is executed, before returnome or after it will be executed, in Return Pre-execution. Chapter 28. Program: Two multiplier with the most efficient method is equal to a few? There are C backgrounds, special programs like to ask this question. 2 << 3 Twentins, two object values ​​(x.equals (y) == true), but there are different Hash Code, this sentence is wrong? No, there is the same Hash Code. Thirty, when an object is passed as a parameter to a method, this method can change the properties of this object, and can return the resulting result, then here is the value delivery or reference delivery? Is a value transfer. The Java programming language is only passed by the value. When an object instance is transmitted to the method as a parameter, the value of the parameter is a reference to the object. The content of the object can be changed in the called method, but the reference to the object will never change. Thirty-first, whether SWTICH can act on Byte, whether it can act on long, can it work on String? Switch (expr1), expr1 is an integer expression. Therefore, the parameters passing to the Switch and the CASE statement should be int, short, char or byte. Long, String can not work on SWTICH. Article 32. Program: Write a Singleton. The main role of the Singleton mode is to ensure that only one example exists in a Java application. General Singleton mode usually has several forms: the first form: Define a class, its constructor is private, it has a state of static private, instantoneation, and GetInstance through a public Method Get a reference to it, then calls it.

转载请注明原文地址:https://www.9cbs.com/read-38706.html

New Post(0)