Java Interview Questions With Answers – Part 2

[1] 2

Here’s part 2 of some Java Interview Questions. The level of questions is suitable for beginners as well advanced core Java programmers.

This part covers basics of Java as well as kickstart your first Java program.

Java-Program-Interview-Questions

The series includes more than 200 questions, so stay tuned for more.

Q11. Does Java support Remote Method Invocation (RMI)?

A11. Yes, Java supports Remote Method Invocation, which is a Java API. The Java RMI API performs remote method invocation i.e. enable a program to invoke methods across a network.

Q12. List some of the new feature introduced in Java SE 8 (Java 8)?

A12.  The new features are:

  • Lambda Expressions
  • New Stream API
  • Package java.util.function introduced.
  • New Time and Date API
  • Supports for JavaFX 8

Q13. How Java is Architecture-Neutral?

A13. Java is Architecture Neutral, since it is platform independent i.e. it follow: write once; run anywhere, any time, forever”. A Java program do not depend on the operating system you have or the hardware, even it do not get affected by Operating System upgrades, ro changes in system resources.

Q14. Which is the following would create a class file “SampleProgram.class” after execution,

  1. Compile time statement – javac SampleProgram.java
  2. Runtime statement – java SampleProgram

A14.  Compile time statement – “javac SampleProgram.java” will create a class file “SampleProgram.class”

javac is Java Compiler that creates a class file of a java program as shown above.

Q15. The Java compiler requires that a source file use the “.java” filename extension. True or false?

A15. True, as shown in Q14 above, we compiled a file named “SampleProgram.java”

Q16. Are Java file names case-sensitive? True or False?

A16. True

Q17. A Java program begins with a call to which function?

A17. Java program begins with a call to main() function.

Q18. What are the three styles of comments Java supports?

A18. Java supports the following three styles of comments,

  • Single-line comment
  • Multi-line comment
  • Documentation comment

Q19. What does “public” mean in the following,

public static void main(String args[ ]) {}

A19. public is a keyword, which is an access modifier

Q20. What does “static” mean in the following,

public static void main(String args[ ]) {}

A20. static is a keyword that allows calls main( ) method without the need  to instantiate a particular instance of the class.

[1] 2

Comments

comments

thegenericwhiz@gmail.com'

GW Editorial Staff

Editorial Staff at Generic Whiz.