Below are the basic Java interview questions and answers. These questions are about JAVA platform, Java editions, Java features and important uses of Java.
1) What is Java?
Java is a Programming Language and a Platform
Java is a Programming Language and a Platform
- Java is used as a programming to develop Software Applications.
- Java is used as Software Platform to run Java Applications
2) What are important Java Editions or Parts of Java?
Java has Three Important Editions
Java has Three Important Editions
- Java Standard Edition / Core Java (* Old name J2SE)
- Java Enterprise Edition / Advanced Java (*Old name J2EE)
- Java Micro Edition (* Old name J2ME)
3) Where Java is used?
Java is used to create,
Java is used to create,
- Desktop Applications
- Web Applications
- Enterprise Applications
- Mobile Applications
- Smart Cards
- Embedded Systems
- Scientific Applications
- Computer Games Etc...
Java is an Open Source Software and Platform independent,
- For Software Development download and install JDK (includes JRE and JVM) Software,
- For Run-time (to run Software Applications that developed in Java) download and install JRE (includes JVM). We can run Java byte code on any supported platform.
5) What are important features of Java?
Important Features of Java are,
Important Features of Java are,
- Simple
- Object Oriented
- Platform independent
- Secured
- Robust,
- Architecture neutral
- Portable
- Interpreted
- Multithreaded
- Distributed
6) What is JVM?
Java Virtual machine (JVM) is the virtual machine that run the Java bytecodes. The JVM doesn't understand Java source code, that's why you compile your *.java files to obtain *.class files that contain the bytecodes understandable by the JVM.
7) What is JRE?
The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language.
8) What is JDK?
Java Development Kit (JDK) is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.
9) What are important Java Language Elements?
Important Language Elements of Java are,
Java Virtual machine (JVM) is the virtual machine that run the Java bytecodes. The JVM doesn't understand Java source code, that's why you compile your *.java files to obtain *.class files that contain the bytecodes understandable by the JVM.
7) What is JRE?
The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language.
8) What is JDK?
Java Development Kit (JDK) is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.
9) What are important Java Language Elements?
Important Language Elements of Java are,
- Data Types
- Modifiers
- Variables
- Operators
- Control Flow Statements
- Methods Etc...
10) What are the Fundamentals of OOPS?
Four fundamentals of Object Oriented Programming are,
Four fundamentals of Object Oriented Programming are,
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
11) What are Java Syntax Rules?
Java Syntax Rules:
Java Syntax Rules:
- Java is a case sensitive language.
- First letter of Class name should be in Upper case.
- Method names should start with lower case letter.
- Java program file name should exactly match with class name.
- Java program execution starts from main method, which is mandatory in every Java program.
- Every statement/step should end with semi colon symbol.
- Code blocks enclosed with {}.
12) How to setup Java Environment on Windows Operating System?
- Download Java Software (JDK) and Install. (Download Java (JDK) Software from either java.com or oracle.com, and Install).
- Set Environment Variable path (Path variable)
- Download Eclipse IDE and extract
- Launch Eclipse IDE, Write Java Program and execute.
After Java Installation then you can get Java folder in C:\Program Files.
Set Environment Variable path (Path variable)
Navigation
First take jdk bin directory path
Select MyComputer and right click
> Properties
> Advanced System Settings
> Environment Variables
> Select Path variable from system variables
> Edit
> Paste java bin directory path in variable value field
> OK
> Ok
>OK
> Close
14) How to write and execute Java Programs using Windows Command Prompt (Without Eclipse IDE)?
In Computer Programming we have three steps.
Step 1: Write a Sample Program in Notepad and save with .java extension
public class Sample {
public static void main (String [] args) {
System.out.println ("Hello Java World");
}
}
public static void main (String [] args) {
System.out.println ("Hello Java World");
}
}
Step 2: Compile the Program
> Launch Command prompt
> Chang to Java program file directory.
> Type javac Sample.java
It creates Java class file
Step 3: Run / Execute the program.
Type java Sample
Then it displays the Output on the Console.
15) What is Eclipse IDE?
Eclipse IDE (Integrated Development Environment)
- Eclipse IDE is a platform to write and execute computer programs like Java, Perl, Python, Ruby, PHP etc...
- Eclipse IDE is open source.
- It provides Editor for writing programs, Syntax guidance, Context help, auto compilation etc...
Using Eclipse IDE we can write and execute Java Programs.
16) How to write and execute Java programs using Eclipse IDE?
Steps to Write and Execute a Java Program using Eclipse IDE :
16) How to write and execute Java programs using Eclipse IDE?
Steps to Write and Execute a Java Program using Eclipse IDE :
- Launch Eclipse IDE
- Create Java Project
- Create Java Package
- Create Java Class
- Write Java Program and Run.
Eclipse IDE provides auto compilation facility.
17) Explain about Java Program Structure?
Sections of Java Program,
17) Explain about Java Program Structure?
Sections of Java Program,
- Documentation Section
- Package declaration statement
- Import Statement/s
- Class declaration
- main Method (Java Program execution starts from main method)
- Declarations (We declare Variables and Constants.)
- General Statements (Ex: d = a + b + c;)
- Code blocks (Condition blocks, Loop Blocks etc...)
Every Normal Statement should end with Semi colon and Every code block enclosed with {}
0 Comment to "JAVA basic Interview Questions and Answers "
Post a Comment