1.Describe your understanding of Object-oriented
what is a class What is an object class is a mold object is an instance of a mold
All things are objects A class is a set of objects that have the same characteristics and similar behavior
Relationship of classes and objects
in reality There are objects first . Post-Extraction production class
in the program First Design class after instantiating an object
Packaging
hide the specific implementation provide an external user interface to call the user
Safety Multiplexing
Inherited
A class inherits from another class all properties of the inherited class are obtained and The process of all methods except the construction method is called inheritance
Polymorphic
multiple subclasses inherit from the same parent class different implementations of the same name method for the parent class declaration known as polymorphic
2. A class is final modified to represent the class.
The final modified class becomes an end-state class that cannot be inherited by other classes. The class cannot contain abstract methods
3. What is the difference between string s= "Hello" and string b=new string ("Hello") ?
use the new keyword to represent a force in memory to open up memory space for storing data
4 . The difference between an interface and an abstract class
the interface is a special class
in the interface only the methods that are not implemented No attributes The method also does not need to be abstract to modify methods and abstract methods in an abstract class that can contain property implementations
a class only one abstract class can be inherited but multiple interfaces can be implemented
5,Math.Round (11.5) How much ? Math.Round ( -11.5) How much ?
12-11
6. How do iterators work in Java?
Traversing a collection element
7, scope public,private,protected, and the difference when not written
public on behalf all other classes are accessible
private representatives can only be accessed in this class.
Protected protected delegates can only be accessed in this class and in subclasses of this class
default the default can be accessed in the same package
8 . What are the differences between method overloads and overrides?
Overload
for a class method Name is the same different parameters multiple overloaded methods can coexist
Override
for parent-child classes that form inheritance method names and parameters are the same methods for parent-child class overrides Child class overrides parent class
9. What is the difference between String and stringbuffer and StringBuilder ?
String is an underlying data type provided by the system
StringBuffer and StringBuilder are both string manipulation classes
StringBuffer thread Safety but low access efficiency
StringBuilder Thread is unsafe but access efficiency is high
10, say arraylist,vector, LinkedList storage performance and characteristics ?
The storage mechanism looks at:
ArrayList and vectors are the same LinkedList are linked list structure
Characteristic view
ArrayList for full query expansion 50%
Vector compared to ArrayList thread safety efficiency and the expansion rate is doubled
LinkedList suitable for frequently inserted and deleted operations
11, the difference between HashMap and Hashtable ?
A) HashMap implement Map interface HashTable inherit from Dictionary class
b) thread insecure but high efficiency thread safety efficiency Low
c) Keys and values can be null key values cannot be null
When doyou use an abstract class and when do you use an interface?
what is the difference between a. Super and this?
Super accesses the parent class of the class super () to access the parent construction
this access to members of this class
Java Interview test questions