R4R
Right Place For Right Person TM
 

R4R Java Core Java Faqs
Previous

Home

Next

 

Core Java Interview Questions and Answers

Introduction to Java Programming


Q:1) The Java interpreter is used for the execution of the source code.

a) True
b) False

Ans: b.

Explain: JVM (Java  Virtual  Machine) use's  interpreter  to convert byte code to machine language at execution time. So Java interpreter is used to execute byte code not source code.

Q:2) On successful compilation. A source  file will created as  .class .

a) True
b) False

Ans: a
Explain: When we compile any file then java complier compile it  and make a class file with same 
class extension.

.Q:3) The Java source code can be created in a Notepad editor

a) True
b) False

Ans: a.

Q:4) The Java Program is enclosed in a class definition .

a) True
b) False

Ans: a.

Q:5) What declarations are required for every Java application?

Ans: A class and the main( ) method declarations.

Q:6) What are the two parts in executing a Java program and their purposes?

Answer: Two parts in executing a Java program are:
Java Compiler
Java Interpreter.

The Java Compiler is used for compilation and the Java Interpreter is used for execution of the application.

Q:7) What are the three OOPs principles and define them?

Ans: Encapsulation, Inheritance and Polymorphism are the three OOPs Principles.

Encapsulation: Is the Mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.

Inheritance: Is the process by which one object acquires the properties of another object.

Polymorphism: Is a feature that allows one interface to be used for a general class of actions.

Q:8) What is a compilation unit?

Ans: Java source code file.

Q:9) What output is displayed as the result of executing the following statement?

System.out.println("// Looks like a comment.");

1.// Looks like a comment
2. The statement results in a compilation error
3.Looks like a comment
4.No output is displayed

Ans: a.


Q:10) In order for a source code file, containing the public class Test, to successfully compile, which of the following must be true?
a. It must have a package statement
b. It must be named Test.java
c. It must import java.lang
d. It must declare a public class named Test
Ans: b

Q:11) What are identifiers and what is naming convention?

Ans: Identifiers are used for class names, method names and variable names. An identifier may be any descriptive sequence of upper case & lower case letters,numbers or underscore or dollar sign and must not begin with numbers.

Q:12) What is the return type of program’s main( ) method?

Ans: void

Q:13) What is the argument type of program’s main( ) method?

Ans: string array.

Q:14) Which characters are as first characters of an identifier?

Ans: A – Z, a – z, _ ,$

Q:15) What are different comments?

Ans: 1) // -- single line comment

2) /* --

*/ multiple line comment

3) /** --

*/ documentation

Q:16) What is the difference between constructor method and method?

Ans: Constructor will be automatically invoked when an object is created. Whereas method has to be call explicitly.

Q:17) What is the use of bin and lib in JDK?

Ans: Bin contains all tools such as javac, applet viewer, awt tool etc., whereas Lib contains all packages and variables


Core Java Interview Questions and Answers

Previous

Home

Next

New Updates

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R