热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

Core Java 面试题与答案

Test your skills through the online practice test: Core Java Quiz Online Practice Test

问题 181. Can an object be garbage collected while it is still reachable?

A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected.

这有帮助吗? 添加评论 查看评论
 

问题 182. What classes of exceptions may be caught by a catch clause?

A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.

这有帮助吗? 添加评论 查看评论
 

问题 183. How can you minimize the need of garbage collection and make the memory use more effective?

Use object pooling and weak object references.

Pooling basically means utilizing the resources efficiently, by limiting access of the objects to only the period the client requires it.
Increasing utilization through pooling usually increases system performance.
Object pooling is a way to manage access to a finite set of objects among competing clients. in other words,
object pooling is nothing but sharing of objects between different clients.
Since object pooling allows sharing of objects ,the other clients/processes need to re-instantiate the object(which decreases the load time), instead they can use an existing object. After the usage , the objects are returned to the pool.

这有帮助吗? 添加评论 查看评论
 

问题 184. Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?

Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.

这有帮助吗? 添加评论 查看评论
 

问题 185. If a class is located in a package, what do you need to change in the OS environment to be able to use it?

You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:devcomxyzhrEmployee.java. In this case, you'd need to add c:dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:>java com.xyz.hr.Employee

这有帮助吗? 添加评论 查看评论
 

" />

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。