Introduction to JavaQuestion: What is Java? State two features.
Answer: Java is a platform-independent, object-oriented programming language. Features: Simple,
Secure, Robust, Portable (WORA - Write Once Run Anywhere). ��Question: Explain JVM, JRE, JDK. �
Answer: JVM executes bytecode; JRE provides runtime environment; JDK includes compiler and tools
for development. �Variables and Data TypesQuestion: List primitive data types with sizes.
Answer: byte (8 bits), short (16 bits), int (32 bits), long (64 bits), float (32 bits), double (64 bits), char (16
bits), boolean (1 bit).Question: Declare variables: integer age=18; String name="Ram"; �
Answer: int age=18; String name="Ram"; �Input/OutputQuestion: Write code to input two integers and
print their sum using Scanner. �
Answer: import [Link]; Scanner sc=new Scanner([Link]); int a=[Link](),
b=[Link](); [Link](a+b); ��Question: Output of [Link]("Hello");
[Link]("World"); �
Answer: HelloWorld (print adds without newline; println adds newline). �Operators and
ExpressionsQuestion: Result of 10 + 5 * 2? �
Answer: 20 (multiplication precedence). �Question: What is a unary operator? Example. �
Answer: Operates on one operand, e.g., ++i (pre-increment). �Conditional StatementsQuestion: Write
program to check if number is even/odd. �
Answer: import [Link].*; Scanner sc=new Scanner([Link]); int n=[Link](); if(n%2==0)
[Link]("Even"); else [Link]("Odd"); �Question: Use ternary: int marks=75; String
grade=(marks>=60)?"Pass":"Fail"; �
Answer: grade="Pass". �