0% found this document useful (0 votes)
24 views3 pages

Java Fundamentals QA

Uploaded by

pinkurai.1206
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Java Fundamentals QA

Uploaded by

pinkurai.1206
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Java Fundamentals - Questions and Answers

1. What is NetBeans IDE?


NetBeans IDE (Integrated Development Environment) is an open-source development
environment mainly used for Java programming. It provides tools to develop, debug, and
deploy applications. It supports multiple languages like Java, PHP, C++, and HTML, offering
features like code completion, project templates, debugging tools, and GUI design support.

2. What is Java Bytecode?


Java Bytecode is the intermediate representation of Java code. When a Java program is
compiled, the source code (.java file) is converted into bytecode (.class file). This bytecode is
platform-independent and can run on any system that has a Java Virtual Machine (JVM).

3. What is JVM? Explain.


JVM (Java Virtual Machine) is a part of the Java Runtime Environment (JRE). It is responsible
for executing Java bytecode on any platform. JVM provides features such as memory
management, garbage collection, and security. It makes Java programs platform-
independent ("Write Once, Run Anywhere").

4. Explain Comments in Java.


Comments in Java are used to explain code and make it more readable. They are ignored by
the compiler.
Types of comments:
- Single-line comment: // comment
- Multi-line comment: /* comment */
- Documentation comment: /** documentation */

5. Explain all Data Types of Java.


Java data types are divided into two categories:

1. Primitive Data Types:


- byte: 8-bit integer
- short: 16-bit integer
- int: 32-bit integer
- long: 64-bit integer
- float: 32-bit decimal
- double: 64-bit decimal
- char: 16-bit Unicode character
- boolean: true/false

2. Non-Primitive Data Types:


- String
- Arrays
- Classes
- Interfaces

6. Define Variables in Java.


A variable in Java is a name given to a memory location that stores data. It is used to store
and manipulate values in a program.

7. What are Different Rules to Declare Variables in Java?


Rules for declaring variables in Java:
- Must start with a letter, $, or _.
- Cannot start with a digit.
- Cannot use reserved keywords.
- Variable names are case-sensitive.
- Should be meaningful and follow camelCase naming convention.

8. What are String Variables?


String variables in Java are used to store sequences of characters. Strings are objects of the
String class and are immutable.
Example: String name = "Java";

9. Explain All the Operators in Java.


Operators in Java are special symbols used to perform operations on variables and values.
Types of operators:
- Arithmetic Operators: +, -, *, /, %
- Relational Operators: ==, !=, >, <, >=, <=
- Logical Operators: &&, ||, !
- Assignment Operators: =, +=, -=, *=, /=
- Unary Operators: +, -, ++, --, !
- Bitwise Operators: &, |, ^, ~, <<, >>, >>>
- Ternary Operator: ? :

10. What are Control Flow Statements in Java?


Control flow statements in Java are used to control the execution of code based on
conditions and loops.
Types:
- Decision-making statements: if, if-else, switch
- Looping statements: for, while, do-while
- Branching statements: break, continue, return

11. Explain Switch Statement in Java.


The switch statement in Java is used to execute one block of code out of multiple options
based on the value of a variable.
Example:
switch (number) {
case 1: System.out.println("One"); break;
case 2: System.out.println("Two"); break;
default: System.out.println("Other");
}

12. Differentiate Between While and Do-While Loop in Java.


While Loop:
- Condition is checked before executing the loop body.
- May not execute if the condition is false.

Do-While Loop:
- Condition is checked after executing the loop body.
- Executes at least once, even if the condition is false.

You might also like