前言
有很多朋友很好奇国外的Java面试题长啥样,今天我们就去找5道国外的面试来和国内的对比一下看看谁难一些!
面试题分享
1. Is Java Platform Independent if then how?( Java平台是独立的吗?)
Yes, Java is a Platform Independent language. Unlike many programming languages javac compiler compiles the program to form a bytecode or .class file. This file is independent of the software or hardware running but needs a JVM(Java Virtual Machine) file preinstalled in the operating system for further execution of the bytecode.
(Java是一种平台无关的语言。与许多编程语言不同,javac编译器将程序编译成字节码或.class文件。该文件独立于运行的软件或硬件,但需要在操作系统中预先安装JVM(Java虚拟机)文件,以便进一步执行字节码。)
Although JVM is platform dependent, the bytecode can be created on any System and can be executed in any other system despite hardware or software being used which makes Java platform independent.
(虽然JVM是平台相关的,但字节码可以在任何系统上创建,并且可以在任何其他系统中执行,而不管使用的是硬件还是软件,这使得Java平台无关。)
点评:国内面试多半会问你jdk、jre、jvm的区别!
2. What are the top Java Features?(Java的主要特性是什么)
Java is one the most famous and most used language in the real world, there are many features in Java that makes it better than any other language some of them are mentioned below:
(Java是真实的世界中最著名和最常用的语言之一,Java中有许多特性使其优于任何其他语言,其中一些如下所述:)
-
Simple: Java is quite simple to understand and the syntax
(简单:Java很容易理解,语法) -
Platform Independent: Java is platform independent means we can run the same program in any software and hardware and will get the same result.
(Java是平台无关的,这意味着我们可以在任何软件和硬件上运行相同的程序,并得到相同的结果。) -
Interpreted: Java is interpreted as well as a compiler-based language.
(解释型:Java是解释型的,也是一种基于编译器的语言。) -
Robust: features like Garbage collection, exception handling, etc that make the language robust.
(健壮:像垃圾收集,异常处理等使语言健壮的特性。) -
Object-Oriented: Java is an object-oriented language that supports the concepts of class, objects, four pillars of OOPS, etc.
(面向对象:Java是一种面向对象的语言,支持类、对象、OOPS的四大支柱等概念。) -
Secured: As we can directly share an application with the user without sharing the actual program makes Java a secure language.
(安全:由于我们可以直接与用户共享应用程序,而无需共享实际程序,因此Java是一种安全的语言。) -
High Performance: faster than other traditional interpreted programming languages.
(高性能:比其他传统的解释性编程语言更快。) -
Dynamic: supports dynamic loading of classes and interfaces.Distributed: feature of Java makes us able to access files by calling the methods from any machine connected.
(动态:支持类和接口的动态加载。分布式:Java的特性使我们能够通过从任何连接的机器调用方法来访问文件。) -
Multithreaded: deal with multiple tasks at once by defining multiple threads
(多线程:通过定义多个线程一次处理多个任务) -
Architecture Neutral: it is not dependent on the architecture.
(架构中立:它不依赖于架构。)
点评:种题目在国内几乎不问!
3. What is JVM? (什么是JVM?)
JVM stands for Java Virtual Machine it is a Java interpreter. It is responsible for loading, verifying, and executing the bytecode created in Java.
(JVM是Java Virtual Machine的缩写,是Java的解释器。它负责加载、验证和执行Java中创建的字节码。)
Although it is platform dependent which means the software of JVM is different for different Operating Systems it plays a vital role in making Java platform Independent.
(虽然它是平台相关的,这意味着JVM的软件在不同的操作系统上是不同的,但它在使Java平台独立方面起着至关重要的作用。)
点评:国内面的一般比这个难,会直接让你说jvm的结构,然后刨根问底,直接把你整蒙圈才放过你!
4. What is JIT? 4.什么是JIT?
JIT stands for (Just-in-Time) compiler is a part of JRE(Java Runtime Environment), it is used for better performance of the Java applications during run-time. The use of JIT is mentioned in step by step process mentioned below:
(JIT(Just-in-Time)编译器是JRE(Java编译环境)的一部分,它用于提高Java应用程序在运行时的性能。JIT的使用在下面提到的一步一步的过程中提到:
)
1.Source code is compiled with javac compiler to form bytecode
(源代码用javac编译器编译成字节码)
2.Bytecode is further passed on to JVM
(字节码被进一步传递到JVM)
3.JIT is a part of JVM, JIT is responsible for compiling bytecode into native machine code at run time.
(JIT是JVM的一部分,JIT负责在运行时将字节码编译成本地机器码。)
4.The JIT compiler is enabled throughout, while it gets activated when a method is invoked. For a compiled method, the JVM directly calls the compiled code, instead of interpreting it.
(JIT编译器始终处于启用状态,而它在调用方法时被激活。对于编译后的方法,JVM直接调用编译后的代码,而不是解释它。)
5.As JVM calls the compiled code that increases the performance and speed of the execution.
(当JVM调用编译后的代码时,它会提高执行的性能和速度。)
点评:国内面试中高级会问这个问题
5. What are Memory storages available with JVM?(JVM提供哪些内存存储?)
1.JVM consists of a few memory storages as mentioned below:
(JVM由下面提到的几个内存存储组成:)
2.Class(Method) Area: stores class-level data of every class such as the runtime constant pool, field, and method data, and the code for methods.
(类(方法)区:存储每个类的类级数据,如运行时常量池、字段和方法数据,以及方法的代码。)
3.Heap: Objects are created or objects are stored. It is used to allocate memory to objects during run time.
(堆:对象被创建或对象被存储。它用于在运行时为对象分配内存。)
4.Stack: stores data and partial results which will be needed while returning value for method and performing dynamic linking
(堆栈:存储返回方法值和执行动态链接时所需的数据和部分结果)
5.Program Counter Register: stores the address of the Java virtual machine instruction currently being executed.
(程序计数器寄存器:存储当前正在执行的Java虚拟机指令的地址。)
6.Native Method Stack: stores all the native methods used in the application.
(原生方法栈:存储应用程序中使用的所有原生方法。)
点评:国内面试的难也差不多!
总结:
国内面试比国外的稍微难一点,但是国外的面试也不简单,都要好好准备才行,要面试的小伙伴们加油啊!!!!! 这些面试题都挺好的,也挺重要的,希望朋友们都能掌握,看到这里如果能点赞加关注,各位都是我义父!!!