在 Java 中使用标记接口的一个很好的例子是[可序列化的](//howtodoinjava.com/java/serialization/a-mini-guide-for-implementing-serializable-interface-in-java/"A mini guide for implementing serializable interface in java")接口。 一个类实现此接口,以指示可以将其非瞬态数据成员写入字节流或文件系统。
在 Java 中使用标记接口的一个很好的例子是[Serializable](//howtodoinjava.com/java/serialization/a-mini-guide-for-implementing-serializable-interface-in-java/"A mini guide for implementing serializable interface in java")接口。 一个类实现此接口,以指示可以将其非瞬态数据成员写入字节流或文件系统。
那么,您真的需要非常深入地了解字符串池的概念,才能回答此问题或类似问题。 我的建议..关于[字符串类和字符串池](//howtodoinjava.com/java/string/interview-stuff-about-string-class-in-java/"String pool concepts")的“认真学习”。
那么,您真的需要非常深入地了解字符串池的概念,才能回答此问题或类似问题。 我的建议...“认真学习”[字符串类和字符串池](//howtodoinjava.com/java/string/interview-stuff-about-string-class-in-java/"String pool concepts")。
*Here comes the main part. Now, as we know that two unequal objects can have same hash code value, how two different objects will be stored in same array location [called bucket]. Answer is `LinkedList`. If you remember, `Entry` class had an attribute “`next`”. This attribute always points to next object in chain. This is exactly the behavior of `LinkedList`.
@@ -17,23 +17,23 @@ Explain transient and volatile keywords in java?
DifferencebetweenIteratorandListIterator?
```
## 为什么要避免使用 finalize()方法?
## 为什么要避免使用`finalize()`方法?
我们都知道,在回收分配给对象的内存之前,垃圾收集器线程会调用[`finalize()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--)方法的基本声明。 请参阅此程序的[,该程序证明根本不能保证`finalize()`调用。 其他原因可能是:](//howtodoinjava.com/java/related-concepts/why-not-to-use-finalize-method-in-java/"Why not to use finalize() method in java")
我们都知道,在回收分配给对象的内存之前,垃圾收集器线程会调用[`finalize()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--)方法的基本声明。 请参阅[这篇文章](//howtodoinjava.com/java/related-concepts/why-not-to-use-finalize-method-in-java/"Why not to use finalize() method in java"),证明根本不能保证`finalize()`调用。 其他原因可能是:
[Abstraction](//howtodoinjava.com/object-oriented/understanding-abstraction-in-java/) captures only those details about an object that are relevant to the current perspective.
Wrapping data and methods within classes in combination with implementation hiding (through access control) is often called encapsulation. The result is a data type with characteristics and behaviors. Encapsulation essentially has both i.e. information hiding and implementation hiding.
> 阅读更多:[编写死锁并使用 Java 解决](//howtodoinjava.com/java/multi-threading/writing-a-deadlock-and-resolving-in-java/ "Writing a deadlock and resolving in java")
另外,我强烈建议阅读[**关于 Java**](//howtodoinjava.com/java/serialization/a-mini-guide-for-implementing-serializable-interface-in-java/"A mini guide for implementing serializable interface in java") 中序列化的完整指南。
另外,我强烈建议阅读[**关于 Java**](//howtodoinjava.com/java/serialization/a-mini-guide-for-implementing-serializable-interface-in-java/"A mini guide for implementing serializable interface in java") 中序列化的完整指南。
[在此处了解有关同步的更多信息。](//howtodoinjava.com/java/multi-threading/thread-synchronization-object-level-locking-and-class-level-locking/"Thread synchronization, object level locking and class level locking")
[在此处阅读更多有趣的事实以及指南。](//howtodoinjava.com/java/related-concepts/working-with-hashcode-and-equals-methods-in-java/"Working with hashCode and equals methods in java")
你能强迫垃圾收集吗? 不,`System.gc()`尽可能接近。 最好的选择是调用`System.gc()`,这只是向垃圾收集器提示您要它进行收集。 由于垃圾收集器是不确定的,因此无法强制立即收集。 另外,在`OutOfMemoryError`文档下,它声明除非 VM 在完全垃圾回收后未能回收内存,否则不会抛出该错误。 因此,如果在出现错误之前一直分配内存,那么您将已经强制执行完整的垃圾回收。
[在此处详细了解垃圾收集。](//howtodoinjava.com/java/garbage-collection/revisiting-memory-management-and-garbage-collection-mechanisms-in-java/"Revisiting memory management and garbage collection mechanisms in java")
对象序列化后,其类中的更改会破坏反序列化过程。 要确定您的类中将来的变化,这些变化将是兼容的,而其他变化将被证明是不兼容的,请在此处 阅读完整的 [**指南。 简而言之,我在这里列出:**](//howtodoinjava.com/java/serialization/a-mini-guide-for-implementing-serializable-interface-in-java/"A mini guide for implementing serializable interface in java")
对象序列化后,其类中的更改会破坏反序列化过程。 要确定您的类中将来的变化,这些变化将是兼容的,而其他变化将被证明是不兼容的,请在此处阅读完整的[**指南**](//howtodoinjava.com/java/serialization/a-mini-guide-for-implementing-serializable-interface-in-java/"A mini guide for implementing serializable interface in java")。 简而言之,我在这里列出:
我强烈建议您阅读这篇文章:[**HashMap 如何在 Java 中工作?**](//howtodoinjava.com/java/collections/how-hashmap-works-in-java/"How hashmap works in java") 这篇文章将帮助您轻松地回答所有与 HashMap 相关的问题。
我强烈建议您阅读这篇文章:[**`HashMap`如何在 Java 中工作?**](//howtodoinjava.com/java/collections/how-hashmap-works-in-java/"How hashmap works in java")这篇文章将帮助您轻松地回答所有与`HashMap`相关的问题。
阅读有关[**ConcurrentHashMap 面试问题**](//howtodoinjava.com/java/collections/popular-hashmap-and-concurrenthashmap-interview-questions/"Popular HashMap and ConcurrentHashMap interview questions")的更多信息。
阅读有关[**`ConcurrentHashMap`面试问题**](//howtodoinjava.com/java/collections/popular-hashmap-and-concurrenthashmap-interview-questions/"Popular HashMap and ConcurrentHashMap interview questions")的更多信息。
#### 14)`HashMap`如何工作?
**最重要的问题**在每个工作面试中最有可能出现。 您必须在这个主题上非常清楚。,不仅因为它是最常被问到的问题,而且会让您对与集合 API 相关的其他问题敞开心 mind。
**最重要的问题**在每个工作面试中最有可能出现。 您必须在这个主题上非常清楚。不仅因为它是最常被问到的问题,而且会让您对与集合 API 相关的其他问题打开思路。
这个问题的答案非常大,您应该阅读我的文章:[**HashMap 如何工作?**](//howtodoinjava.com/java/collections/how-hashmap-works-in-java/"How hashmap works in java") 现在,让我们记住 HashMap 在[Hashing ]原理上工作**。 根据定义,映射是:“将键映射到值的对象”。 为了存储这种结构,**使用了内部类 Entry** :**
这个问题的答案非常大,您应该阅读我的文章:[**`HashMap`如何工作?**](//howtodoinjava.com/java/collections/how-hashmap-works-in-java/"How hashmap works in java") 现在,让我们记住`HashMap`在哈希原理上工作。 根据定义,映射是:“将键映射到值的对象”。 为了存储这种结构,**使用了内部类`Entry`**:
阅读 post 中的阻塞队列示例用法: [**如何使用阻塞队列?**](//howtodoinjava.com/java-5/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/"How to use BlockingQueue and ThreadPoolExecutor in java")
阅读文章中的阻塞队列示例用法: [**如何使用阻塞队列?**](//howtodoinjava.com/java-5/how-to-use-blockingqueue-and-threadpoolexecutor-in-java/"How to use BlockingQueue and ThreadPoolExecutor in java")