0% found this document useful (0 votes)
4 views1 page

Java Programming Basics Explained

Java is a platform-independent, object-oriented programming language known for its simplicity, security, robustness, and portability. Key components include JVM for executing bytecode, JRE for the runtime environment, and JDK for development tools. The document also covers primitive data types, input/output operations, operators, and conditional statements with examples.

Uploaded by

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

Java Programming Basics Explained

Java is a platform-independent, object-oriented programming language known for its simplicity, security, robustness, and portability. Key components include JVM for executing bytecode, JRE for the runtime environment, and JDK for development tools. The document also covers primitive data types, input/output operations, operators, and conditional statements with examples.

Uploaded by

mittinamtaying
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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". �

You might also like