Professional Documents
Culture Documents
Deepanshu It1 60
Deepanshu It1 60
Deepanshu
IT-1 (06011503121)
Q1 - Operators in Java:
Operators:
1. Arithmetic operators:
Arithmetic operators are used to perform basic mathematical
operations like addition, subtraction, multiplication, division, and
modulus. The plus (+) operator is used to add two numbers or
concatenate strings. The minus (-) operator is used to subtract one
number from another. The asterisk (*) operator is used to multiply two
numbers. The forward slash (/) operator is used to divide one number
by another. The modulus (%) operator is used to find the remainder
when one number is divided by another.
2. Relational operators:
Relational operators are used to compare two values and return a
boolean result (true or false). The equal to (==) operator is used to
check if two values are equal. The not equal to (!=) operator is used to
check if two values are not equal. The greater than (>) operator is
used to check if one value is greater than another. The less than (<)
operator is used to check if one value is less than another. The
greater than or equal to (>=) operator is used to check if one value is
greater than or equal to another. The less than or equal to (<=)
operator is used to check if one value is less than or equal to another.
3. Logical operators:
Logical operators are used to combine two or more boolean
expressions and return a boolean result. The AND (&&) operator is
used to check if both expressions are true. The OR (||) operator is
used to check if either expression is true. The NOT (!) operator is used
to invert the result of a boolean expression.
4. Bitwise operators:
Bitwise operators are used to perform bit-level operations on integer
types. The bitwise AND (&) operator performs a bitwise AND
operation on two values. The bitwise OR (|) operator performs a
bitwise OR operation on two values. The bitwise XOR (^) operator
performs a bitwise XOR operation on two values. The bitwise
complement (~) operator performs a bitwise complement operation on
a value.
5. Assignment operators:
Assignment operators are used to assign values to variables. The
simple assignment (=) operator is used to assign a value to a variable.
The addition assignment (+=) operator is used to add a value to a
variable and assign the result to the same variable. The subtraction
assignment (-=) operator is used to subtract a value from a variable
and assign the result to the same variable. The multiplication
assignment (*=) operator is used to multiply a variable by a value and
assign the result to the same variable. The division assignment (/=)
operator is used to divide a variable by a value and assign the result
to the same variable. The modulus assignment (%=) operator is used
to find the remainder when a variable is divided by a value and assign
the result to the same variable.
6. Conditional operator:
The conditional operator (also known as the ternary operator) is a
shorthand way of writing if-then-else statements. It has the syntax:
condition ? expression1 : expression2. If the condition is true,
expression1 is evaluated and returned. If the condition is false,
expression2 is evaluated and returned.
Q2 - Security promises of the JVM Java,
security architecture and security policy:
Java Virtual Machine (JVM) provides a secure environment
for running Java programs. Some of the security promises of
the JVM include:
2. Class loading: The JVM loads classes from trusted sources and
ensures that the loaded classes do not violate any security
policies. The JVM also provides mechanisms for isolating
classes from different sources and preventing them from
interacting with each other in unauthorized ways.
3. Memory management: The JVM uses a garbage collector to
manage memory allocation and deallocation, which prevents
buffer overflows and other memory-related vulnerabilities.
The Java security architecture is a set of APIs and tools that provide
security services to Java applications. Some of the key components of
the Java security architecture are: